If the above statement, I is a variable, so it is wrong to write directly, excuse me how should express the I variable,
Is "" + I +" "?? If that is wrong
CodePudding user response:
"' + I +" 'three quotes on, try itCodePudding user response:
Do not recommend using splicing SQL statements, convert the Format function
ADOQuery_sbcx. SQL. Text:=Format (' SELECT yqmc, count (*) FROM [ZHXT] [dbo] [SBGL] where left ([yqmc], % d)=% s group by yqmc ', [I, QuotedStr (Adoquery2. FieldByName (' yqmc). AsString) are identical]);
CodePudding user response:
String to use QuotedStr, looks much more pleasing to the eyeADOQuery_sbcx. SQL. Text:='SELECT yqmc, count (*) FROM [ZHXT] [dbo] [SBGL] where left ([yqmc], I)=' +
QuotedStr (Adoquery2 FieldByName (' yqmc). The value) +
'group by yqmc'
CodePudding user response:
ADOQuery_sbcx. SQL. Text:='SELECT yqmc, count (*) FROM [ZHXT] [dbo] [SBGL] where left ([yqmc],' + inttostr (I) + ')='" + Adoquery2. FieldByName (' yqmc). The value + "' group by yqmcCodePudding user response:
"' +! + "'CodePudding user response:
ADOQuery_sbcx. SQL. Text:='SELECT yqmc, count (*) FROM [ZHXT] [dbo] [SBGL] +''where the left ([yqmc],' + InttoStr (I) + ')='+
QuotedStr (Adoquery2 FieldByName (' yqmc). AsString) are identical + 'group by yqmc'
CodePudding user response: