zurehman 0 Newbie Poster

This error Show when i cliick Button3
ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in pending local transaction. The transaction property of the command has not been initialized.

Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim strSql As String

        If Con.State = 1 Then Con.Close()
        Con.Open()
        Dim myTrans As SqlClient.SqlTransaction = Con.BeginTransaction()
        Try
            '***  Ist Table Update
            strSql = "Insert into others(othcod,othnam,address,active,status) Values(" & Me.txtOthCod.Text & ",'" & Me.txtOthNam.Text & "','" & Me.txtAddress.Text & "','" & Me.txtActive.Text & "','" & mStatus & "')"
            Dim cmd As SqlCommand = New SqlCommand(strSql, Con)
            cmd.ExecuteNonQuery()

            '***  2nd Table Update
            strSql = "Insert into oth_opn(othcod,opndat) Values(" & Me.txtOthCod.Text & ",'" & yOpnDat & "')"
            Dim cmd2 As SqlCommand = New SqlCommand(strSql, Con)
            cmd2.ExecuteNonQuery()


            myTrans.Commit()
            ClsWinMessage.ShowWinMessage(" Data Saved Successfully ....... !", "Account Management System", MessageBoxIcon.Information, MessageBoxButtons.OK)

        Catch ex As Exception
            MsgBox(ex.Message)
            ' **** If any errors occur, then rollback the transaction.
            myTrans.Rollback()
            MsgBox("An error occurred with one of the database " & _
              "updates. No changes were saved to the " & _
             "database.")
        Finally
            Con.Close()
        End Try

    End Sub

please help me
thanks in advance