I have the following simple code:
Private ConStr As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Server.MapPath("\someDatabase.mdb")
Private Sub Page_Load(Sender As Object, E As EventArgs) Handles MyBase.Load
' Response.Redirect("home.html")
Dim Con As New OLEDBConnection(ConStr)
Dim InsertStr As String = "Insert into someTable(ComputerIP, LogTime) values('" & Request.UserHostAddress & "', '" & DateTime.Now & "')"
Dim InsertCommand As New OLEDBCommand(InsertStr, Con)
Dim RowInserted As Integer
Try
Con.Open()
RowInserted = InsertCommand.ExecuteNonQuery()
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Finally
If Not Con Is Nothing Then
Con.Close()
End If
End Try
End Sub
I got the error message "Operation must use an updateable query". Does anyone know how to fix this?
Thanks
Private ConStr As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Server.MapPath("\someDatabase.mdb")
Private Sub Page_Load(Sender As Object, E As EventArgs) Handles MyBase.Load
' Response.Redirect("home.html")
Dim Con As New OLEDBConnection(ConStr)
Dim InsertStr As String = "Insert into someTable(ComputerIP, LogTime) values('" & Request.UserHostAddress & "', '" & DateTime.Now & "')"
Dim InsertCommand As New OLEDBCommand(InsertStr, Con)
Dim RowInserted As Integer
Try
Con.Open()
RowInserted = InsertCommand.ExecuteNonQuery()
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Finally
If Not Con Is Nothing Then
Con.Close()
End If
End Try
End Sub
I got the error message "Operation must use an updateable query". Does anyone know how to fix this?
Thanks