比如我要創建一個表,再向表里插入數據,我的語句是
ADOQuery1.Connection.BeginTrans;
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('Create table ...');
ADOQuery1.ExecSQL;
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('Insert into table ...');
ADOQuery1.ExecSQL;
ADOQuery1.Connection.CommitTrans ;
執行時出錯
ADOQuery1.Connection.BeginTrans;
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('Create table ...');
ADOQuery1.ExecSQL;
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('Insert into table ...');
ADOQuery1.ExecSQL;
ADOQuery1.Connection.CommitTrans ;
執行時出錯
解决方案 »
- 一个涉及到四则混合运算的工业产品价格预算系统。
- 向DLL传参 和 释放 pchar
- (50分)超级简单问题
- 现在一Delphi动态库(没有类),如何用asp调用?(查到的资料基本是VB的Dll)
- 求一算法 算一TXT文件中英文单词 以及 短语出现的次数(如果几个“连续单词”连续出现多次则称为短语)(解决再加200分)
- 怎样屏蔽edit中的快捷键??/
- 请问哪里介绍Msg.message所表达意思的资料?
- ************* 难!难!难! *******************
- 各位如何使多线程的程序降低CPU耗用率
- 哪里能下载ADO的最新版本,如何安装?
- 这种情况该怎么写?
- Delphi内嵌汇编
try
with ADOQuery1 do
begin
Connection.BeginTrans;
Close;
SQL.Clear;
SQL.Add('Create Table ...')'
ExecSQL;
Close;
SQL.Clear;
SQl.Text := 'Insert into...';
ExecSQl;
Connection.CommitTrans;
end;
except
ADOQuery1.Connection.RollBackTrans;
end;
2.出错的信息呢?单看语句没错
3.是不是漏了个Drop Table??在第二次执行的时候就会报表已存在??
Project IQCTest.exe raised exception class EAccessViolation with message 'Access violation at address 0047EBF5 in module 'IQCTest.exe'.Read of address 0000006C'.
语句测试过,没问题,测试环境:Delphi7, mysql5.1.30
with ADOQuery1 do
begin
Connection.BeginTrans;
Close;
SQL.Clear;
SQL.Add('Create Table ...')'
ExecSQL;
Close;
SQL.Clear;
SQl.Text := 'Insert into...';
ExecSQl;
Connection.CommitTrans;
end;
except
ADOQuery1.Connection.RollBackTrans;
end;