/// <summary>
/// 事务处理
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public bool InportData(string strSql)
{
SqlConnection sqlConnection = new SqlConnection(DbHelperSQL.connectionString);
sqlConnection.Open();
SqlTransaction myTrans = sqlConnection.BeginTransaction();
SqlCommand sqlInsertCommand = new SqlCommand();
sqlInsertCommand.Connection = sqlConnection;
sqlInsertCommand.Transaction = myTrans;
try
{
sqlInsertCommand.CommandText = strSql.ToString();
sqlInsertCommand.ExecuteNonQuery();
myTrans.Commit();
return true;
}
catch (Exception ex)
{
myTrans.Rollback();
return false;
}
finally
{
sqlConnection.Close();
}
}