我有如下语句:
adoQuery5.SQL.Text := 'Sum(Rec_Sum)'+
' from Rec'+' where Rec_Address = '''+ANComboBox3.Text+''' and Rec_Type= '''+MainSortString+'''';
但运行时说Rec_Sum附近有语法错误,请问正确的格式是什么?谢谢

解决方案 »

  1.   

    adoQuery5.SQL.Text := 'select Sum(Rec_Sum) as sum_Rec from Rec'+' where Rec_Address = '''+ANComboBox3.Text+''' and Rec_Type= '''+MainSortString+'''';
    ----------------------------------------------------------------
                 花自飘零水自流,一种相思,两处闲愁。
                   此情无计可消除,才下眉头,又上心头。
    ----------------------------------------------------------------
      

  2.   

    adoQuery5.SQL.Text := ' select Sum(Rec_Sum) as sum_Rec from Rec '+
    ' where Rec_Address = '+
    #39+ANComboBox3.Text+#39 +
    ' and Rec_Type= '+
    #39+MainSortString+#39;