同志们,进来逛逛.特别有请数据库查询高手.(100分)

这个问题让我发疯,兄弟刚学delphi么??
 
類始於 自動產生腳本功能......
 
ndch请解释一下参数查询。谢谢,小弟刚学delphi也是刚学编程。或者那位高手解释一下,
小弟感激不仅,下次见面一定给分。谢谢
另外我一般这样处理
str :=trim(combobox1.text);
strSql :='select * from bbs where hello='''+str+'''';
query1.close;
query1.sql.clear;
query1.sql.add(strSql);
query1.open;
---->为什么没有人这样写是不是这样做用什么缺点????

 
用query1.sql.add(Memo1.Lines.Strings[0]);
试试
 
呵呵查了帮助和相关资料我懂了,古城兄祝你好运
 
用下面的寫法試試:
query1.close;
query1.sql.clear;
query1.sql.add('select * from bbs ');
query1.sql.add('where hello='+''''+combobox1.text+'''');
query1.open;
 
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from bbs where hello=:hello');
adoquery1.Parameters.ParamByName('hello').Value := combobox1.text;
adoquery1.open;
OK,基本是参数化查询就是这样子了。
 
多人接受答案了。
 
顶部