Alright, I am really stuck this time. I simply can't insert a damn record into a database.
After trying several other methods, I ran accross this sample:
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=insertmdb and more specifically this part:
I adapted it to my needs, but when I tried to access my page it says Operation must use an updateable query. on the line where I call the ExecuteNonQuery() method.
Confused, I deciced to download the whole example and run it on my computer. I downloaded their mdb file and copy/pasted the code in a new page. When I ran the sample, it gave the same error where cmd.ExecuteNonQuery is.
I have no idea what's going on.
After trying several other methods, I ran accross this sample:
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=insertmdb and more specifically this part:
Sub doInsert(Source as Object, E as EventArgs)
Dim MySQL as string = "Insert into testInsert (fname, lname) values (@Fname, @Lname)"
Dim myConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("\Data\TestInsertDB.mdb") & ";")
Dim Cmd as New OleDbCommand(MySQL, MyConn)
cmd.Parameters.Add(New OleDbParameter("@Fname", frmfname.text))
cmd.Parameters.Add(New OleDbParameter("@Lname", frmlname.text))
MyConn.Open()
cmd.ExecuteNonQuery
MyConn.Close()
label1.visible="true"
BindData()
label1.text = "Your data has been received!"
End Sub
I adapted it to my needs, but when I tried to access my page it says Operation must use an updateable query. on the line where I call the ExecuteNonQuery() method.
Confused, I deciced to download the whole example and run it on my computer. I downloaded their mdb file and copy/pasted the code in a new page. When I ran the sample, it gave the same error where cmd.ExecuteNonQuery is.
I have no idea what's going on.