下面使出错的代码:
try
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('select max(zhh)+1 from jbzh');
Open;
zhh:=Fields[0].AsInteger;
Close;
end;//执行正常 with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('Insert into jbzh(zhh,sh) values('+IntToStr(zhh) +',''A'')');
ExecSQL;
end;//报错,SQL语句是没有错误的!如果把第二个ADOQuery1换成其他的
ADOQuery就是好的,好像给人感觉是一个ADOQUERY只能执行一遍!
一下是错误信息:
Debugger Exception Notification
---------------------------
Project XXXX.exe raised exception class EAccessViolation with message 'Access violation at address 1F487CAB in module 'msado15.dll'. Write of address 0122B024'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
求助!
try
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('select max(zhh)+1 from jbzh');
Open;
zhh:=Fields[0].AsInteger;
Close;
end;//执行正常 with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('Insert into jbzh(zhh,sh) values('+IntToStr(zhh) +',''A'')');
ExecSQL;
end;//报错,SQL语句是没有错误的!如果把第二个ADOQuery1换成其他的
ADOQuery就是好的,好像给人感觉是一个ADOQUERY只能执行一遍!
一下是错误信息:
Debugger Exception Notification
---------------------------
Project XXXX.exe raised exception class EAccessViolation with message 'Access violation at address 1F487CAB in module 'msado15.dll'. Write of address 0122B024'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
求助!
begin
SQL.Clear;
SQL.Add('Insert into jbzh(zhh,sh) values('+IntToStr(zhh) +',''A'')');
ExecSQL;
end;//报错,SQL直接用adoconnection执行就可以了:
adoconnection1.execute('Insert into jbzh(zhh,sh) values('+IntToStr(zhh) +',''A'')');
....
ADOQuer1.open;