G
Guest
I keep getting this error message when I try to INSERT a record into ACCESS
on a WEB server with the following .NET code: (It works okay for SELECT
statements) I've read somewhere that it could be due to a permissions
problem but my ISP has said my code has full permissions to the .mdb file.
Can anyone suggest something ?
Dim sAppPath As String
sAppPath = Server.MapPath("\Private\gerrytest.mdb")
Dim cnn As New
OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & sAppPath)
Dim cmd As New OleDb.OleDbCommand
Dim sValue As String
sValue = txtSurname.Text
cmd.CommandText = "INSERT INTO Customer VALUES (" & Chr(39) & sValue
& Chr(39) & ");"
Try
cmd.Connection = cnn
cnn.Open()
cmd.ExecuteNonQuery() 'THIS IS WHERE THE ERROR OCCURS
Catch ex As Exception
sValue = ex.ToString
txtSurname.Text = sValue
Finally
cnn.Close()
End Try
on a WEB server with the following .NET code: (It works okay for SELECT
statements) I've read somewhere that it could be due to a permissions
problem but my ISP has said my code has full permissions to the .mdb file.
Can anyone suggest something ?
Dim sAppPath As String
sAppPath = Server.MapPath("\Private\gerrytest.mdb")
Dim cnn As New
OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & sAppPath)
Dim cmd As New OleDb.OleDbCommand
Dim sValue As String
sValue = txtSurname.Text
cmd.CommandText = "INSERT INTO Customer VALUES (" & Chr(39) & sValue
& Chr(39) & ");"
Try
cmd.Connection = cnn
cnn.Open()
cmd.ExecuteNonQuery() 'THIS IS WHERE THE ERROR OCCURS
Catch ex As Exception
sValue = ex.ToString
txtSurname.Text = sValue
Finally
cnn.Close()
End Try