i guess the error was caused be some statement before instantiating the transaction variable "InTrans" and inside catch block you were trying to rollback before starting the transaction. try to separate the try block for the transaction part or check InTrans for nothing before trying to roll back in the catch block like
........
........
If found = 0 Then
Try
InTrans = Con.BeginTransaction()
InCommand.Connection = Con
InCommand.Transaction = InTrans
InCommand.CommandText = UpdateStr1
InCommand.ExecuteNonQuery(
InCommand.CommandText = UpdateStr2
InCommand.ExecuteNonQuery(
Response.Write("<script language='JavaScript'>aler
InTrans.Commit()
Catch ex1 As Exception
Try
InTrans.Rollback()
Catch ex As OleDbException
If Not InTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " & ex.GetType().ToString & _
" was encountered while attempting to roll back the transaction.")
End If
End Try
Console.WriteLine("An exception of type " & e.GetType().ToString() & _
"was encountered while inserting the data.")
Console.WriteLine("Neither
End Try
End If
Catch ex1 As Exception
Try
InTrans.Rollback()
Catch ex As OleDbException
If Not InTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " & ex.GetType().ToString & _
" was encountered while attempting to roll back the transaction.")
End If
End Try
'Catch ex As OleDbException
Console.WriteLine("An exception of type " & e.GetType().ToString() & _
"was encountered while inserting the data.")
Console.WriteLine("Neither
Finally
Con.Close()
End Try
Main Topics
Browse All Topics





by: shovavnikPosted on 2005-01-29 at 04:47:31ID: 13171270
Try:
If Not InTrans Is Nothing Then InTrans.Rollback()