QRYTEMP2.SQL.Add('DELETE FROM QM_WIP2_MRB_Y_DETAIL;');
QRYTEMP2.SQL.Add('INSERT INTO QM_WIP2_MRB_Y_DETAIL( USER_3,SCRAP_UM)('+SQLTXT1+');');
QRYTEMP2.SQL.Add('INSERT INTO QM_WIP2_MRB_Y_DETAIL(USER_4,SCRAP_UM)('+STR1+');');
QRYTEMP2.SQL.Add('DELETE FROM QM_TEMP_WIP2ST_RECORD;');
QRYTEMP2.ExecSQL;
with qrytemp2 do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;有錯誤,該怎麽寫啊?
QRYTEMP2.SQL.Add('INSERT INTO QM_WIP2_MRB_Y_DETAIL( USER_3,SCRAP_UM)('+SQLTXT1+');');
QRYTEMP2.SQL.Add('INSERT INTO QM_WIP2_MRB_Y_DETAIL(USER_4,SCRAP_UM)('+STR1+');');
QRYTEMP2.SQL.Add('DELETE FROM QM_TEMP_WIP2ST_RECORD;');
QRYTEMP2.ExecSQL;
with qrytemp2 do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;有錯誤,該怎麽寫啊?
解决方案 »
- 丢脸了,答应帮人家做个自动登录器,居然搞不定。。
- MessageDld消息函数中yes按钮的返回值
- 谁知道delphi代码哪个站最多
- 呵呵,好久没来Delphi版了,送给兄弟们一个礼包,里面有几百篇精选的文章,希望对大家有所帮助~~~
- ljmanage你好,进来领分!!!!
- 急!在线问....
- 关于集合类型,请大家帮忙。应该不难的,但我刚学请帮忙请解一下。
- 近来在看《delphi6应用开发指南》,发现问题请求解答
- ql的问题,select * from table where date1>=''01-10-10'' 到底行不行的
- 求金山词霸的MMX半透明窗口代码
- 如何Ado 用户动态配置ConnectionString
- 我把FastReport的对象查看器弄丢了~~
QRYTEMP2.SQL.Add('DELETE FROM QM_WIP2_MRB_Y_DETAIL;');
QRYTEMP2.ExecSQL;
QRYTEMP2.SQL.Add('INSERT INTO QM_WIP2_MRB_Y_DETAIL( USER_3,SCRAP_UM)('+SQLTXT1+');');
QRYTEMP2.ExecSQL;
.
.
.
這時候執行了第一個sql,表裏面的數據就被刪掉了
要是芳到過程裏面,查詢條件太多了我不知道query可不可以這麽寫?
begin
dm.adoconnection1.BeginTrans;
try
dm.ADOQuery4.Close;
dm.ADOQuery4.sql.clear;
dm.ADOQuery4.SQL.add('select password from users where mobile_phone='''+s+'''');
dm.ADOQuery4.Open;
if dm.ADOQuery4.RecordCount <= 0 then
begin
dm.ADOQuery2.Close;
dm.ADOQuery2.sql.clear;
dm.ADOQuery2.SQL.add('insert into t_smssent(f_mobile,f_msgcontent,f_status) values('''+s+''',''请您先注册!'',0)');
dm.ADOQuery2.ExecSQL;
end;
dm.ADOQuery3.Close;
dm.ADOQuery3.sql.clear;
dm.ADOQuery3.SQL.add('update t_smsreceived set f_status=1 where f_id='+sss+'');
dm.ADOQuery3.ExecSQL;
dm.adoconnection1.CommitTrans;
except
dm.adoconnection1.RollbackTrans;
end;
end;