Author: Jackxxx | Posted on: 3/7/2010 2:09:17 PM | Views : 375

 I only want something to happen if the transaction is committed (tr.commit()) How can I do that?
Dim transTrue As Boolean Dim cmdInsert1 As SqlCommand Dim tr As SqlTransaction = Nothing Dim ConnectStr As String = _ ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim conn As New SqlConnection(ConnectStr) cmdInsert1 = New SqlCommand cmdInsert1.CommandType = CommandType.StoredProcedure cmdInsert1.CommandText = "PostAndApply" Try conn.Open() tr = conn.BeginTransaction() cmdInsert1.Transaction = tr cmdInsert1.Connection = conn cmdInsert1.ExecuteNonQuery() tr.Commit() 'if committed then true transTrue = True If transTrue = True Then 'DO this only if tr.commit() ...

Go to the complete details ...