DLYH_Q.Parameters.ParamByName('xulh').Value:=trim(xulh.Text);
DLYH_Q.Parameters.ParamByName('jiqxh').Value:=trim(jiqxh.Text); DLYH_Q.ExecSQL;怎么知道DLYH_Q.ExecSQL 究竟运行了什么sql语句?
showmessage(DLYH_Q.sql.asstring)不能看到具体的参数,delphi老是提示我变量错误
来自:1020ace, 时间:2005-12-19 18:32:16, ID:3302237
建议不使用这种方法!!!我的一般做法。
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx='+''''+trim(xulh.text)+'''');
execsql;
end;
这样来加入变量要方便一些,必要时候可以让他在edit显示出来检测
如有错误,还请大虾指点!
来自:sxper, 时间:2005-12-19 19:43:01, ID:3302275 | 编辑
天地良心.
开玩笑.
来自:雾锁长河, 时间:2005-12-19 20:28:04, ID:3302309
ParamByName('xulh').asstring:=trim(xulh.Text);
来自:hn_yxb, 时间:2005-12-19 21:21:51, ID:3302355
showmessage(adoquery1.sql.text)
来自:sxper, 时间:2005-12-20 8:55:08, ID:3302578 | 编辑
郁闷了我.
来自:sxper, 时间:2005-12-24 20:27:46, ID:3307820 | 编辑
问题很难吗
来自:sushicheng, 时间:2005-12-24 20:43:46, ID:3307833
说得没有错
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx='+''''+trim(xulh.text)+'''');
execsql或open;//论情况面定,如果有记录返回,则用open,若无则用execsql,
不过你为什么不用adocommand;
end;
来自:anso, 时间:2005-12-24 21:17:15, ID:3307844
晕,ParamByName绝对是第一选择,这样sql效率高
但是你无法显示出具体数值的,因为你的sql就是这样的,使用变量,也是用变量传递给数据库的。你用Parameters 给变量赋值
来自:芳泽, 时间:2005-12-26 9:30:14, ID:3308451
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx=:parameter');
ParamByName('parameter').asstring:='****';
execsql或者open;
end;
DLYH_Q.Parameters.ParamByName('jiqxh').Value:=trim(jiqxh.Text); DLYH_Q.ExecSQL;怎么知道DLYH_Q.ExecSQL 究竟运行了什么sql语句?
showmessage(DLYH_Q.sql.asstring)不能看到具体的参数,delphi老是提示我变量错误
来自:1020ace, 时间:2005-12-19 18:32:16, ID:3302237
建议不使用这种方法!!!我的一般做法。
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx='+''''+trim(xulh.text)+'''');
execsql;
end;
这样来加入变量要方便一些,必要时候可以让他在edit显示出来检测
如有错误,还请大虾指点!
来自:sxper, 时间:2005-12-19 19:43:01, ID:3302275 | 编辑
天地良心.
开玩笑.
来自:雾锁长河, 时间:2005-12-19 20:28:04, ID:3302309
ParamByName('xulh').asstring:=trim(xulh.Text);
来自:hn_yxb, 时间:2005-12-19 21:21:51, ID:3302355
showmessage(adoquery1.sql.text)
来自:sxper, 时间:2005-12-20 8:55:08, ID:3302578 | 编辑
郁闷了我.
来自:sxper, 时间:2005-12-24 20:27:46, ID:3307820 | 编辑
问题很难吗
来自:sushicheng, 时间:2005-12-24 20:43:46, ID:3307833
说得没有错
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx='+''''+trim(xulh.text)+'''');
execsql或open;//论情况面定,如果有记录返回,则用open,若无则用execsql,
不过你为什么不用adocommand;
end;
来自:anso, 时间:2005-12-24 21:17:15, ID:3307844
晕,ParamByName绝对是第一选择,这样sql效率高
但是你无法显示出具体数值的,因为你的sql就是这样的,使用变量,也是用变量传递给数据库的。你用Parameters 给变量赋值
来自:芳泽, 时间:2005-12-26 9:30:14, ID:3308451
with adoquery1 do
begin
close;
sql.clear;
sql.add('......where xxx=:parameter');
ParamByName('parameter').asstring:='****';
execsql或者open;
end;
参数
ShowMessage(DLYH_Q.Parameters.ParamByName('YourParam').AsString);
s:string;
I:Integer;
begin
with DLYH_Q do
begin
for i:=0 to SQL.Count-1 do
s:=s+#10#13+SQL[i];
end;
ShowMessage(s);
end;