Dim conn As New SqlConnection()
Dim cmd As New SqlCommand()
Dim transact As SqlTransaction()
With conn
.ConnectionString = ("...somestring...")
.Open()
End With
transact = conn.BeginTransaction
Try
With cmd
.Connection = conn
.CommandType = CommandType.Text
.CommandText = ("exec someproc '123' , 'test'")
.ExecuteNonQuery()
End With
transact.Commit()
Exit Try
Catch
transact.Rollback()
End Try |