My INSERT statement has a syntax error but I am not sure where. The error message says there'r on line 13 but I cant't see the problem. Can somebody help?
Imports System.Data.OleDb
Public Class Form2
Dim cnn As OleDbConnection
Dim cmd As New OleDbCommand
Dim sqlstr As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
cnn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Library.accdb;")
cnn.Open()
sqlstr = "INSERT INTO Users (ID,User_Name,Password) VALUES ('" & txtID.Text & "','" & txtUser.Text & "','" & txtPassword.Text & "')"
cmd = New OleDbCommand(sqlstr, cnn)
cmd.ExecuteNonQuery()
cnn.Close()
MsgBox("User saved.")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class