Okay I’m trying to move from VB to C# with mixed success.
I’m getting the following errors:
-
The best overloaded method match for
‘_DataInteraction.stdReturnDataTable(string, ref
System.Collections.Generic.List,
string)’ has some invalid arguments -
Argument 2 must be passed with the ‘ref’ keyword
Both referencing: the myParamList noted with ** in
I have this code in C#
{
List<SqlParameter> myParamList = new List<SqlParameter>();
SqlParameter myParam = default(SqlParameter);
myParam = new SqlParameter("@sAMAccountName", SqlDbType.VarChar);
myParam.Value = ID;
myParamList.Add(myParam);
**dt = _DI.stdReturnDataTable("cit_ResolveUser", myParamList, "x");**
return dt;
}
Now the code for stdReturnDataTable (just the top part which accepts the arguments)
public static DataSet stdReturnDataset(string procedureName, ref List<SqlParameter> myParameters, string db)
{
//code
}
As the error message says, you should pass the argument with the
refkeyword:Also, as per your comment, it’s a static method, you can not call it through an instance variable. Instead you need to qualify it using the typename.
But I suspect the ref keyword is actually not needed here, you can probably just remove it from the method signature.