procedure TForm1.Button1Click(Sender: TObject);
var e1:string;
begin
e1:=edit1.Text;with datamodule2.ADOQuery1 do
begin
close;
sql.add('insert into ck005(data)values("'+e1+'")');
try
open;
except
showmessage('报错信息');///
end;
end;end;问题提示:
Project Project1.exe raised exception class EOleException with message '第2行':')'附近有语法错误。‘.Process stopped.Use Step or Run to continue
var e1:string;
begin
e1:=edit1.Text;with datamodule2.ADOQuery1 do
begin
close;
sql.add('insert into ck005(data)values("'+e1+'")');
try
open;
except
showmessage('报错信息');///
end;
end;end;问题提示:
Project Project1.exe raised exception class EOleException with message '第2行':')'附近有语法错误。‘.Process stopped.Use Step or Run to continue
在Delphi中不支持双引号,只有单引号的"'+e1+'"
改成
sql.add('insert into ck005(data)values('+e1+')');
试试!
改为:sql.add('insert into ck005(data)values('+e1+')');
->
如果ck005是数字型,改为
sql.add('insert into ck005(data)values('+e1+')');
ExceSQL;
如果ck005是字符型,改为
sql.add('insert into ck005(data)values('''+e1+''')');
ExceSQL;
2:(data)后面的括号是全角而不是半角
其他同楼上
begin
try
close;
sql.clear;
sql.add('insert into ck005(data)values("'+e1+'")');
open
except
Project Project1.exe raised exception class EOleException with message '第2行':')'附近有语法错误。‘.Process stopped.Use Step or Run to continue
这个问题还是在啊 cyblueboy83(爱情白痴—电脑迷)
#39这个代表什么意思啊?
with datamodule2.ADOQuery1 do
begin
close;
clear;
sql.add('insert into ck005([data]) values('''+e1+''')');
exceSQL;
end;