error constructor with no parameters does not exist

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.
 
M

Mark Fitzpatrick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top