thomas008
Well-known member
I have a datable which contains my data. I display the data in a datagridview. All commands i use are stored procedures. The update and insert commands work fine. The deletecommand works fine when I delete one record and then update to the database. When delete more then one record i get:
Here is the code where i create the parameters and the command
This is the stored procedure:
I tried to change:
to:
But i still get the same error.
Can anyone help me?
VB.NET:
concurency violated: deletecommand affected 0 of the expected 1 records
Here is the code where i create the parameters and the command
VB.NET:
myConnection = New OleDbConnection
myConnection.ConnectionString = myconnectionstring
myCommand = New OleDbCommand
myCommand.Connection = myConnection
myCommand.CommandText = deletecommand
myCommand.CommandType = CommandType.StoredProcedure
parameter = New OleDbParameter
parameter.ParameterName = "inroutingpointID"
parameter.DbType = DbType.Double
parameter.SourceColumn = "ID"
parameter.SourceVersion = DataRowVersion.Original
myCommand.Parameters.Add(parameter)
'MessageBox.Show("deletecommand= " & myCommand.CommandText)
myAdapter.DeleteCommand = myCommand
This is the stored procedure:
VB.NET:
sSQL = "CREATE PROC procRoutingpointDelete(inroutingpointID LONG) AS DELETE * FROM routingpoint WHERE ID = inroutingpointID;"
I tried to change:
VB.NET:
parameter.SourceVersion = DataRowVersion.Original
to:
VB.NET:
parameter.SourceVersion = DataRowVersion.Current
But i still get the same error.
Can anyone help me?