Today I was trying to run some code and I could not figure out why it was failing. When I looked at the logs I noticed it would run one time, then fail. Took me a minute to realize why this was failing, but finally it hit me. (No, this is not my code, in fact today was the first time I have ever seen this is my life :()
Can anyone see what is wrong?
The error message was -- Procedure or function updateSubmitQDocID has too many arguments specified.
SqlCommand insComm = new SqlCommand();
foreach (DataRow row in dt.Rows)
{
...
...
...
if (conn != null && conn.State != ConnectionState.Open)
{
conn.Open();
}
// updates the entry for the doc ID in the SubmitQ to 1
insComm.CommandText = "updateSubmitQDocID";
insComm.CommandType = CommandType.StoredProcedure;
insComm.Parameters.Add("@docID", SqlDbType.VarChar, 30);
insComm.Parameters["@docID"].Value = row["docID"].ToString();
insComm.Connection = conn;
insComm.ExecuteNonQuery();
...
...
...
}
Just love find good nuggets of fun code.
Till next time,