public int set(string procName , object[] param)
{
SqlConnection conn = new SqlConnection(constr);
conn.Open();
SqlCommand cmd = new SqlCommand(procName,conn);
cmd.CommandType = CommandType.StoredProcedure;
foreach(object o in param)
{
cmd.Parameters.Add(o); // Error
}
int res = cmd.ExecuteNonQuery();
conn.Close();
return res;
}
The values are correctly passed via the calling function... The 2nd parameter of the function 'set' contains 2 string values.
Even at the ERROR statment the 'o' contains the first value "Computer" but represent ERROR as stated above.