天天看點

(C#)執行多條SQL語句,事務處理

///

   /// 執行多條SQL語句,事務處理

   ///

以";"相隔的查詢語句

   public bool InsertMoreDB(string strSQL){

    char[] de={’;’};

    string strChildSQL;

    int i;

    string[] strSQLArr=strSQL.Split(de);

    bool IsControll=true;

    SqlConnection conn=DBCreateCN();

    SqlCommand myCommand=new SqlCommand();

    SqlTransaction myTrans;

    myTrans=conn.BeginTransaction();