I made this mistake:
SqlConnection Con=new SqlConnection(_myConString);
SqlTransaction tr=Con.CreateTransaction();
tr=Con.CreateTransaction();
Lines 2 and 3 create transactions. So I was getting an error. I fixed it and the problem is resolved.
Conclusion: a call to CreateTransaction before the transaction completes raises the above exception.
source
share