I have a ArrayList of SqlParameters that I created but when I try to access it, it says:
At least one element in the source array could not be cast down to the destination array type.
The code is:
I try to return an SqlParameter[] with a procedure:
I get the error on the return.
What am I missing?
Thanks,
Tom
At least one element in the source array could not be cast down to the destination array type.
The code is:
Code:
ArrayList s = new ArrayList();
s.Add(new SqlParameter("@CompanyID", SqlDbType.Int).Value = 1);
s.Add(new SqlParameter("@ClientID", SqlDbType.Int).Value = 2);
I try to return an SqlParameter[] with a procedure:
Code:
public static SqlParameter[] GetSqlParameterArray(ArrayList al)
{
return (SqlParameter[])al.ToArray(typeof(SqlParameter));
}
I get the error on the return.
What am I missing?
Thanks,
Tom