Y ynfly Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #1 请问如何在delphi中实现动态sql语句动态查询,应该要用到tQuery控件吧, 他的语句应该怎样,能举一下例吗?这样对我帮助会更大一些,欢迎Email联系
M mitsukow Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #2 tquery.close; tquery.sql.text := 'sql 语句' tquery.open;
大 大木头 Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #3 with Query1 do try Screen.Cursor:=crSQLWait; DisableControls; Close; SQL.Clear; SQL.Add('SELECT *'); SQL.Add('FROM '+TableName); SQL.Add('WHERE 字段名=值'); SQL.Add('ORDER BY 字段名'); SQL.Open; finally EnableControls; Screen.Cursor:=crDefault;
with Query1 do try Screen.Cursor:=crSQLWait; DisableControls; Close; SQL.Clear; SQL.Add('SELECT *'); SQL.Add('FROM '+TableName); SQL.Add('WHERE 字段名=值'); SQL.Add('ORDER BY 字段名'); SQL.Open; finally EnableControls; Screen.Cursor:=crDefault;
吴 吴剑明 Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #4 tquery.close; tquery.sql.text := 'sql 语句' tquery.open; or tquery.execsql
W wtiger Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #7 with tquery do begin if active then close; sql.clear; sql.add:= 'sql' tquery.open; // or tquery.execsql end;
with tquery do begin if active then close; sql.clear; sql.add:= 'sql' tquery.open; // or tquery.execsql end;
Z zhangkan Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #8 Query1.sql.clear; Query1.sql.add('select * from youdata'); query1.open; 就可開庫了。 若你要加參數: Query1.sql.clear; Query1.sql.add('select * from youdata where youfields=aram'); Query1.Params[0]:='1'; Query1.open﹔ 即可。
Query1.sql.clear; Query1.sql.add('select * from youdata'); query1.open; 就可開庫了。 若你要加參數: Query1.sql.clear; Query1.sql.add('select * from youdata where youfields=aram'); Query1.Params[0]:='1'; Query1.open﹔ 即可。
B bluebob Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-02 #9 var myquerystr,mycon:string; mycon:='name='+'bluebob' ; //you can change it use TEDIT myquerystr:='select * form mytable where '+mycon; query1.sql.add(myquerystr); query1.open;
var myquerystr,mycon:string; mycon:='name='+'bluebob' ; //you can change it use TEDIT myquerystr:='select * form mytable where '+mycon; query1.sql.add(myquerystr); query1.open;