View Code
public
int
ExecuteSql(List
<
string
>
listsql) { OleDbCommand command
=
null
;
try
{ Open(); command.Connection
=
conn; command.Transaction
=
conn.BeginTransaction();
int
i
=
0
;
foreach
(
string
sql
in
listsql) { command.CommandText
=
sql; i
+=
command.ExecuteNonQuery(); } command.Transaction.Commit();
return
i; }
catch
(OleDbException e) { command.Transaction.Rollback();
foreach
(
string
sql
in
listsql) log.Error(sql, e); }
return
0
; }
转载于:https://www.cnblogs.com/Mr0909/archive/2011/05/13/2045780.html
转载请注明原文地址: https://mac.8miu.com/read-26653.html