You need to split the code as follows:
- Outside the loop - declare
cmd
. Add the 3 parameters to it, along with their types. DO NOT assign values at this stage. - Inside the loop - assign the appropriate values to the parameters and then execute the statement.
Your code should look something like this (I assumed all parameters to be integers, so you need to modify based on your actual types):
OleDbCommand cmd = new OleDbCommand(statement, cn);
cmd.Parameters.Add("@Status", OleDbType.Integer);
cmd.Parameters.Add("@count", OleDbType.Integer);
cmd.Parameters.Add("@id", OleDbType.Integer);
for (int index = 0; index < _listResult.Count; index++)
{
cmd.Parameters["@Status"].Value = _listResult[index].Status;
cmd.Parameters["@count"].Value = _listResult[index].Count;
cmd.Parameters["@Id"].Value = _listResult[index].Id;
cmd.ExecuteNonQuery();
}