delphi 通过事务插入数据
orsn1.StartTransaction; try qry1.Sql.Clear; qry1.Sql.Text:=' select * from log '; qry1.Open; qry1.Insert; qry1.FieldByName('Rq').AsDateTime:=StrToDate(FormatDateTime('yyyy-mm-dd',Czrq)); qry1.FieldByName('User').AsString:=Czy; qry1.Post; qry1.ApplyUpdates; orsn1.Commit; qry1.CommitUpdates; except orsn1.Rollback; end;
好的代码像粥一样,都是用时间熬出来的