Re: QueryBuilder and OLEDB by gianluca
gianluca
Thu Sep 18 11:00:03 CDT 2003
The IN clause take one parameter in this form:
('value1',value2',....,'valueN') if the field is a char or varchar,
but I can't set this value with the Parameters method.
Simple doesn't work, return 0 rows.
I know there are workaround like dynamic building of the query ecc.
but I think that the query builder is a good tool and should work with
the IN clause.
Thanks
GM
"Patrick" <PatrickM@idinet.com> wrote in message news:<06ba01c37d26$9dbbddb0$a001280a@phx.gbl>...
> Gianluca, I think the problem is that you are assigning
> one parameter two values. Try using:
> myDataAdapter.SelectCommand.Parameters
> ["param1"].Value="'COD1'";
>
> myDataAdapter.SelectCommand.Parameters
> ["param2"].Value="'COD2'";
>
> assuming there are two input parameters in the parameter
> collection named param1 and param2.
>
> Hope this helps.
>
>
>
> >-----Original Message-----
> >I'm using VS .NET 2003 ASP.NET project C#.
> >
> >If I create a query like this in the query builder
> (using the
> >selectcommand of a oledbDataAdapter)
> >
> >SELECT * FROM TABLE WHERE ID IN (?)
> >
> >and pass the parameters in this way
> >
> >myDataAdapter.SelectCommand.Parameters
> ["paramName"].Value="'COD1','COD2'";
> >
> >when I fill the dataset I obtain no rows.
> >
> >If I change the commandtext in
> >
> >SELECT * FROM TABLE WHERE ID IN ('COD1','COD2')
> >
> >I obtain 10 rows when fill the dataset.
> >
> >Can someone help me?
> >
> >Thanks
> >Gianluca Miseria
> >.
> >