Home > Back-end > Delphil used to use transactions
Delphil used to use transactions
Time:09-24
Qry:=TAdoQuery. Create (nil); Qry. Connection:=conn. qry. Connection. BeginTrans; For I:=0 to TFilePathList. Do the count - 1 The begin STRM. LoadFromFile (TFilePathList [I]); Qry. SQL. The add (' insert into test (PIC) values (: PIC) '); Qry. The Parameters. ParseSQL (qry. SQL. Text, true); Qry. The Parameters. ParamByName (' PIC). LoadFromStream (STRM, ftBlob); end; Qry. ExecSQL; qry.Connection.Com mitTrans; Why always last one data store? If the above storage using transaction (below is the reference is essentially transactions), red font is I use transactions, or no, you did a great god ideas?
For I:=1 to 10000 do The begin Name:=QuotedStr (' easyboot + InttoStr (I)); SqlStr=SqlStr + Format (' insert into MyTest (Name) values (% s) ', [Name]); end; ADOConnection1. Open; ADOConnection1. BeginTrans; ADOCommand1.Com mandText:=SqlStr; ADOCommand1. The Execute (); ADOConnection1.Com mitTrans;
CodePudding user response:
Qry. ExecSQL; Put a loop inside! You put out is always the last one, of course!
CodePudding user response:
Qry. ExecSQL; Put a loop inside! The qry. SQL. add (' insert into test (PIC) values (: PIC) '); Don't have to ADD, Qry. SQL. Text:="insert into test (PIC) values (: PIC) '; As if there is no efficiency increases,