|
-
March 2nd, 2010, 08:54 PM
#1
Help with c# arrays, please.
I am familare with arrays from Perl but c# is a new ball game for me. With the help of a few users from this board I recently created an object to handle SQL calls. When I tested it today I got an array error of: CS0225 The params parameter must be a single dimensional array. The line of code is:
public static int ExecNonQuerySP(string SPName, params List<SqlParameter> Params)
Can anyone help me with this as I have no experiance with multi-dimensional arrays and need a bit of help with what is wrong on this. Full code of that object:
public static int ExecNonQuerySP(string SPName, params List<SqlParameter> Params)
{
int RetVal = 0;
using (SqlConnection con = GetCon())
{
SqlCommand cmd = new SqlCommand(SPName, con);
cmd.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter Param in Params)
{
cmd.Parameters.Add(Param);
}
cmd.Connection.Open();
RetVal = cmd.ExecuteNonQuery();
}
return RetVal;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|