Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim con As New OleDbConnection("provider= microsoft.jet.oledb.4.0;data source=" & CurDir() & "\bilingual1.mdb")
Dim reader As OleDbDataReader
Dim cmd As New OleDbCommand
Try
con.Open()
Dim str As String
str = " insert to yoruba (ọro,itumo,geesi) values ('" & TextBox1.Text & "', '" & RichTextBox1.Text & "', '" & RichTextBox2.Text & "')"
cmd = New OleDbCommand(str, con)
reader = cmd.ExecuteReader
MsgBox("new word added.")
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Dispose()
End Try
insertion in vb.net ( it returns syntax error in insert to statement in a textbox)
45 views Asked by John At
1
You shouldn't need a Reader for an INSERT command. I changed the Cmd method to ExecuteNonQuery() for INSERT command and reformatted the command text for readability.