Could someone tell me how to handle passing an array of strings to my LINQ stored procedure?
The storedProc was created by dragging an existing sproc onto the dbml page. storedProc takes 3 (or any number) of parameters that I determine the value of in GetStringParams().
The error: No overload for storedProc takes 1 argument
DataClassDataContext db = new DataClassDataContext();
//storedProc takes 3 params
gridview.DataSource = db.storedProc(GetStringParams());
gridview.DataBind();
private string[] GetStringParams()
{
string[] params = new string[3];
//Perform some logic here to determine which params to pass
if (somethingIsTrue)
params = new string[] { "param1", "param2", "param3" };
else if (somethingElseIsTrue)
params = new string[] { "param1", "param2", "" };
else
params = new string[] { "", "", "" };
return params;
}
Thanks in Advance. I searched for this question but couldn’t find exactly what I was looking for. Preferably not having to modify the sproc.
You can’t pass an array to a multi-parameter method unless the method asks for a params array.