在一个查询语句中使用同一变量2次,结果不正确,为什么?谢谢(100)

S

sns

Unregistered / Unconfirmed
GUEST, unregistred user!
string1:=' UPDATE UDeposit SET CloseDate =:workdate where pendate<=:workdate ' ; with Qry1 do begin close; sql.Clear; sql.Add(string1) ; parameters.ParamByName('workdate').Value:=workdate; execsql; end; 执行结果不正确,数据库更新的字段无变化将变量改为两个,结果正确string1:=' UPDATE UDeposit SET CloseDate =:workdate1 where endate<=:workdate ' ; with Qry1 do begin close; sql.Clear; sql.Add(string1) ; parameters.ParamByName('workdate1').Value:=workdate; parameters.ParamByName('workdate').Value:=workdate; execsql; end;
 
2个where语句都不一样。。。。。
 
已解决,查询语句参数名字必须唯一
 
顶部