Hello,
I have a problem with some SQL queries that are wrapped inside a transaction. Here's how the code looks like:
using (SqlTransaction dbTrans = conn.BeginTransaction())
{
using (SqlCommand cmd = conn.CreateCommand())
{
for(Parameters p in parameterList)
try
{
//execute insert commmand
}
catch
{
//log exception
//SQL server rolls back everything
//even though no rollback statement is present!!!
}
}
dbTrans.Commit();
}
I'm trying to execute some insert statements inside a transaction but if one fails, everything gets auto rollbacked. I know that in most situations this behavior is wanted by in my scenario it doesn't matter if a few statements don't make it. The reason for the transaction's existence is to improve speed. I know about bulk insert, but unfortunately I cannot use it here, so this is what I have to work with. Could you please tell me if it's possible to disable this behavior I described?