F
Fred Geurtsen
Question about updating a access Database Record!
Normally i'm working with SQLserver, but i have to do this with access and it's not working.
My error is: Operation must use an updateable query.
This is my code:
Dim objCommand As OleDbCommand
Dim strSQLQuery As String
' Our insert command
strSQLQuery = "Update Regios SET Regio=@TextRegio WHERE RegioID=@RegioID "
' Create new command object passing it our SQL insert
' and telling it which connection to use.
objCommand = New OleDbCommand(strSQLQuery, conStoreAdmin)
' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New OleDbParameter("@TextRegio", OleDbType.VarChar, 500))
objCommand.Parameters.Add(New OleDbParameter("@RegioID", OleDbType.Integer))
' Set the values of these parameters:
objCommand.Parameters("@TextRegio").Value = strKAT
objCommand.Parameters("@RegioID").Value = intID
' Open the connection, execute the command, and close the connection.
conStoreAdmin.Open()
objCommand.ExecuteNonQuery()
conStoreAdmin.Close()
Thx
Normally i'm working with SQLserver, but i have to do this with access and it's not working.
My error is: Operation must use an updateable query.
This is my code:
Dim objCommand As OleDbCommand
Dim strSQLQuery As String
' Our insert command
strSQLQuery = "Update Regios SET Regio=@TextRegio WHERE RegioID=@RegioID "
' Create new command object passing it our SQL insert
' and telling it which connection to use.
objCommand = New OleDbCommand(strSQLQuery, conStoreAdmin)
' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New OleDbParameter("@TextRegio", OleDbType.VarChar, 500))
objCommand.Parameters.Add(New OleDbParameter("@RegioID", OleDbType.Integer))
' Set the values of these parameters:
objCommand.Parameters("@TextRegio").Value = strKAT
objCommand.Parameters("@RegioID").Value = intID
' Open the connection, execute the command, and close the connection.
conStoreAdmin.Open()
objCommand.ExecuteNonQuery()
conStoreAdmin.Close()
Thx