sql与edit中的加减问题!(10分)

Y

yyjqtww

Unregistered / Unconfirmed
GUEST, unregistred user!
try
with Query2 do
begin
Close;
SQL.Text := 'update ykucuntab set total=total+strtoint(edit8.text)' + ' where isbn='+''''+edit2.text+''''+'';
ExecSQL;
end;
except
raise
end
这段代码中有
total=total+strtoint(edit8.text)
可是运行时出错,为什么呢!我想将表中的total字段加上edit8中的内容,请问应该如何实现呢?
 
SQL.Text := 'update ykucuntab set total=total+'+
strtoint(edit8.text) + ' where isbn='+''''+edit2.text+''''+'';
 
SQL.Text := 'update ykucuntab set total=total+'+
strtoint(edit8.text) + ' where isbn='+ QuotedStr(edit2.text);
 
strtoint()肯定不能写在SQL里面了
 
就是这样。同意yzhshi的答案。
 
SQL.Text := 'update ykucuntab set total=total+'+
edit8.text + ' where isbn='#39 + edit2.text + #39;
 

SQL.Text := 'update ykucuntab set total=total+'+edit8.text + ' where isbn='+''''+edit2.text+'''';
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
751
import
I
I
回复
0
查看
631
import
I
I
回复
0
查看
609
import
I
顶部