How does adoquery bind parameters to SQL statements ?? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061222162013160.html
For example, in an adoquery SQL statement, what if the value following 'select * From Table1 where' is a parameter? What if this parameter is an integer ??
The format function is usually used to format SQL statements.
Adoquery. SQL. text: = format ('select * From Table1 where field1 = ''% s' and field2 = % d', ['A', 12]);
For the meaning of % s and % d, refer to format help.
Adoquery. SQL. Text: = 'select * From Table1 where afield =: afield'
Adoquery. Parameters. parambyname ('afield '). Value: = xxxxxx;
Where fieldname =: myparam;
Runtime
Dataset. parambyname ('myparam'): = 1;
Dataset. open;
If this problem occurs, you should find a book faster. Isn't LZ having no Delphi book? Is it just a temporary issue of Delphi?
Thank you. I used the ": variable" method, but it does not seem to work. I am a beginner in Delphi.
Can I use adoquery. Params. parambyname ?? I don't know how to use this. Please help me more !! Thank you !!
I have an extra "medium" word and re-reply it.
The format function is usually used to format SQL statements.
Adoquery. SQL. Text: = format ('select * From Table1 where field1 = ''% s' and field2 = % d', ['A', 12]);
% S indicates that the parameter is a string, and % d indicates that the parameter is integer. For other parameters, see the help of format.