大家帮我看看这下面的语句错哪了?我两种方法都不能插入纪录。2种方法用SQL.SaveToFile取得的SQL语句在access中都是过了可以插入语句。为什么在Delphi中却报错?Project RManage.exe raised exception class EOleException with message 'INSERT INTO 语句的语法错误。'. Process stopped. Use Step or Run to continue. 1、 with DModule.ADOQManage do
begin
Close;
SQL.Clear;
SQL.Add('insert into manage(user,password,quanxian)');
SQL.Add('values(:username,:password,:quanxian)');
Parameters.ParamByName('username').Value:=Trim(Edit1.Text);
Parameters.ParamByName('password').Value:=Trim(edit2.Text);
Parameters.ParamByName('quanxian').Value:=ComboBox1.Text;
SQL.SaveToFile('c:\123.txt');
ExecSQL;
end; 2、 with DModule.ADOQManage do
begin
Close;
SQL.Clear;
SQL.Add('insert into manage(user,password,quanxian)');
SQl.Add('values('+''''+Trim(Edit1.Text)+''''+','+''''+Trim(edit2.Text)+''''+','+''''+ComboBox1.Text+''''+')');
SQL.SaveToFile('c:\123.txt');
ExecSQL;
end;
begin
Close;
SQL.Clear;
SQL.Add('insert into manage(user,password,quanxian)');
SQL.Add('values(:username,:password,:quanxian)');
Parameters.ParamByName('username').Value:=Trim(Edit1.Text);
Parameters.ParamByName('password').Value:=Trim(edit2.Text);
Parameters.ParamByName('quanxian').Value:=ComboBox1.Text;
SQL.SaveToFile('c:\123.txt');
ExecSQL;
end; 2、 with DModule.ADOQManage do
begin
Close;
SQL.Clear;
SQL.Add('insert into manage(user,password,quanxian)');
SQl.Add('values('+''''+Trim(Edit1.Text)+''''+','+''''+Trim(edit2.Text)+''''+','+''''+ComboBox1.Text+''''+')');
SQL.SaveToFile('c:\123.txt');
ExecSQL;
end;
SQL.Add('values(:username,:password,:quanxian)');
SQL.Add('values(:username,:password,:quanxian)');
user, password 是 ACCESS 的保留字
不是吧,楼上够快
SQL.Add(' values(:username,:password,:quanxian)');