关于更新字段~~~~~~~~~~(100分)

  • 主题发起人 主题发起人 fl112900
  • 开始时间 开始时间
F

fl112900

Unregistered / Unconfirmed
GUEST, unregistred user!
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.ConnectionString:=srcstr1;
adoquery1.SQL.Add('ALTER TABLE daa add column qk char(4) null' );//添加字段
adoquery1.sql.add('update daa set qk=''i'' from daa a,data b where a.jh = b.jh and a.el between b.jd1 and b.jd2');//更新字段的值~~~~~~~
adoquery1.ExecSQL;
add 添加字段成功
而 update 却要出错 那上面那样为字段更新值不对吗?
'[Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized phrase/keyword'.
 
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.ConnectionString:=srcstr1;
adoquery1.SQL.Add('ALTER TABLE daa add column qk char(4) null' );//添加字段
adoquery1.ExecSQL;
adoquery1.sql.add('update daa set qk=''i'' from daa a,data b where a.jh = b.jh and a.el between b.jd1 and b.jd2');//更新字段的值~~~~~~~
adoquery1.ExecSQL;
是一时
 
adoquery1.sql.add('update daa set qk=(SELECT ''i'' from daa a,data b where a.jh = b.jh and a.el between b.jd1 and b.jd2)');
 
Johnny_du
'[Microsoft][ODBC Visual FoxPro Driver]Function name is missing )'.
会出现这样的错误!!!
 
这样呢?
adoquery1.sql.add('update daa set qk=(SELECT ''i'' from daa a,data b where a.jh = b.jh and (a.el between b.jd1 and b.jd2))');
另外,你肯定是你的字段添加成功了吗?
 
with adoquery1.do
begin
Close;
SQL.Clear;
SQL.Add('ALTER TABLE daa add column qk char(4) null' );//添加字段
ExecSQL;
//添加字段
clear;
//update 后改为别名a
sql.add('update a set qk=''i'' from daa a,data b where a.jh = b.jh and a.el between b.jd1 and b.jd2');
ExecSQL;
end;
 
后退
顶部