Methods:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim shipperNames As String() = {"First Shipping Company", "Second Shipping Company", "Third Shipping Company", Nothing} Using rs As New Framework_Code.TxnWrite("NorthwindConnectionString") Try For i As Byte = 0 To 3 ' Change this to 2 for a successful commit because CompanyName cannot be NULL/Nothing. rs.SetParameterValue("CompanyName", shipperNames(i)) rs.ExecuteNonQuery("INSERT INTO Shippers (CompanyName) VALUES (@CompanyName)") Next rs.Commit() Catch ex As Exception rs.Rollback() End Try Label1.Text = IIf(rs.IsCommitted, "Committed", "Rolledback") End Using End Sub