david7777
06-12-2003, 01:07 PM
I know how to create a DSNless connection to ms access database, and how to query etc, but when i try to insert data, i come to a problem...
I have the following code:
Dim dbconn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database.mdb"))
dbconn.Open()
Dim dbcomm As System.Data.OleDb.OleDbCommand = dbconn.CreateCommand()
Dim sql As String = "INSERT INTO tblUsers VALUES( 0, '" & UserName.Text & "', '" & UserPass.Text & "')"
dbcomm.CommandText = sql
Dim results as Integer = dbcomm.ExecuteNonQuery()
What am i doing wrong?
It gives the error of:
"Operation must use an updateable query. "
I have the following code:
Dim dbconn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database.mdb"))
dbconn.Open()
Dim dbcomm As System.Data.OleDb.OleDbCommand = dbconn.CreateCommand()
Dim sql As String = "INSERT INTO tblUsers VALUES( 0, '" & UserName.Text & "', '" & UserPass.Text & "')"
dbcomm.CommandText = sql
Dim results as Integer = dbcomm.ExecuteNonQuery()
What am i doing wrong?
It gives the error of:
"Operation must use an updateable query. "