I am very new to the world of Access and have been trying to get an asp.net application to insert a record into a table. I keep getting an error stating :
Syntax error in INSERT INTO statement
I have checked my insert statement over many times and if I actually print it to the page and then copy it onto the clipboard. Then, I go into the Access db and enter it in the SQL window, it inserts just fine.
Here is the SQL:
insert into users (username, password, nickname) values ('testuser','testpwd','testnickname')
That table(users) looks like this:
uid autonumber (pk)
username text (pk)
I created this table new this morning and have not done anything in regards to security. I have not difficulty retrieving data from the table. Here is the code I am using:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oConn As OleDbConnection
Dim sql As String
Dim cmdInsert As OleDbCommand
sql = "insert into users (username, password, nickname) values ('" & _
txtUsername.Text & "','" & _
txtPassword.Text & "','" & _
txtNickname.Text & "')"
oConn = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;data source=C:\testing.mdb;")
cmdInsert = New OleDbCommand(sql, oConn)
Catch err As Exception
lblError.Text = sql
Am I just having problems because whatever user is opening the database does not have insert priviledges? If so, how would I set it up so that they do?