ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized
ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized
While using transaction in Asp.net/C# I got above error.
To solve this error I simply added Transaction object in SqlCommand like below
SqlTransaction Transaction; conn.Open(); Transaction = conn.BeginTransaction(); SqlCommand cmd = new SqlCommand(sql, conn, Transaction);
0 comments:
Post a Comment