error constructor with no parameters does not exist

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi I am using a dataobject and trying to add two select parameters as follows:
ObjectDataSource1.SelectParameters.Clear();
ObjectDataSource1.SelectParameters.Add("DepartmentID", ("1");
ObjectDataSource1.SelectParameters.Add("Active", "1");
I get the error message that makes it appear that the parameters are not
being added, thanks.
 
Did you retype the following code, or was it copied and pasted.
ObjectDataSource1.SelectParameters.Add("DepartmentID", ("1");

I ask because if you notice, you are passing the second parameter as ("1"),
which is incorrect. In this case just remove the extra ( right before the
"1";

The next issue though, would be the "1". Are you trying to pass a default
value? If so then you'll need to look closer at the parameter constructor
definition. It expects the second parameter passed into the constructor to
be a TypeCode as in
ObjectDataSource1.SelectParameters.Add("DepartmentID",TypeCode.Int32);
that could also get you an error if you are trying to pass a default value
isntead.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
Back
Top