For some reason when I try to add data to my database I keep getting:
A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: Missing semicolon (;) at end of SQL statement.
Here is my code. Now I have installed the database engine, and I have changed the cpu to x86.
Private Sub SaveButton_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
If DirectCast(AdminCheckBox, CheckBox).Checked = True Then
Dim result1 As Integer
Dim cmd As New OleDb.OleDbCommand
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & "C:\Users\daNo\Documents\Visual Studio 2013\Projects\WindowsApplication1\WindowsApplication1\bin\chem.accdb;"
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
result1 = MsgBox("Are you sure you want to add this user a admin?", MsgBoxStyle.YesNo, "Add New User")
If result1 = vbYes Then
cmd.Connection = cnn
cmd.CommandText = "INSERT INTO Users(UserName, [password], Email) " & _
"VALUES(?,?,?)'"
cmd.Parameters.AddWithValue("@p1", Me.UserNameTextBox.Text)
cmd.Parameters.AddWithValue("@p2", Me.PasswordTextBox2.Text)
cmd.Parameters.AddWithValue("@p3", Me.EmailTextBox.Text)
cmd.ExecuteNonQuery()
MsgBox("Account has been created!", MsgBoxStyle.OkOnly, "Add New User")
Dim ACCSETTINGS As New ACCSETTINGS
ACCSETTINGS.Show()
Me.Hide()
Me.Close()
ElseIf result1 = vbNo Then
Dim NEWUSER As New NewUser
NEWUSER.Show()
Me.Hide()
End If
End If