"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No w

  • Thread starter Thread starter checoz
  • Start date Start date
C

checoz

I'm trying to do a INSERT in a table with this code:

protected int RunProcedure(string storedProcName, IDataParameter[]
parameters, out int rowsAffected){
int result=0;
rowsAffected = 0;
try{
Connection.Open();
OleDbCommand command = BuildIntCommand(storedProcName,parameters);
rowsAffected = command.ExecuteNonQuery();
result = (int)command.Parameters["ReturnValue"].Value;
Connection.Close();
}
catch(OleDbException e){...
}

private OleDbCommand BuildIntCommand(string storedProcName,
IDataParameter[] parameters)
{
OleDbCommand command = BuildQueryCommand(storedProcName,parameters);
command.Parameters.Add(new OleDbParameter("ReturnValue",
OleDbType.Numeric, 4,
ParameterDirection.ReturnValue,
false,
0,
0,
string.Empty,
DataRowVersion.Default,
null));
return command;
}



private OleDbCommand BuildQueryCommand(string storedProcName,
IDataParameter[] parameters)
{
OleDbCommand command = new OleDbCommand(storedProcName, Connection);
command.CommandType = CommandType.StoredProcedure;
foreach(OleDbParameter parameter in parameters)
{
command.Parameters.Add(parameter);
}
return command;
}

My DataBase is Access 2000 and the called store is:
PARAMETERS [@ID_INTERVENTO] Long;
INSERT INTO TABLE_NAME(FIELD1)
VALUES ([@PARAM1]);

On command.ExecuteNonQuery() i have always this error:
"Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done."

Have you got any solutions??
thanks
 
Hi Checoz,

My advise in this is always the same in this, first try it without your
stored procedure, that makes the problem easier to trap. And after that use
your stored procedure again.

Cor
 
Back
Top