3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by G_Waddell
0
'code to insert textbox1 and textbox2 values into sample database
Dim con As New OleDb.OleDbConnection
        Dim cmd As OleDbCommand
        Dim myquery As String
        Dim transaction As OleDbTransaction
        con.ConnectionString = "your connection string"
        con.Open()
        transaction = con.BeginTransaction
        Try
            'query to insert record into Login database table schedules 
            myquery = "INSERT INTO sample VALUES('" & (texbox1.text) & _
                       "','" & (textbox2.Text) & "')"

            cmd = New OleDbCommand(myquery, con, transaction)
            cmd.ExecuteNonQuery()
            transaction.Commit()
         Catch ex As Exception
            transaction.Rollback()
            MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text)
        End Try
        transaction.Dispose()
        cmd = Nothing
        con.Close()

Edited by b1izzard: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.