'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 6 Years Ago by b1izzard: n/a

This question has already been answered. Start a new discussion instead.