Pass value to parameter

  • Thread starter Thread starter isee
  • Start date Start date
I

isee

Hi
If I have program like this
command.CommandText = "select * from users where
user_type in (:pUserType)"
then I want to pass value "type1,type2" to the the
parameter
What's the right way to do this
command.Parameters.Add("pUserType",
OracleType.VarChar).Value = "type1,type2"?

or
command.Parameters.Add("pUserType",
OracleType.VarChar).Value = "'type1','type2'"?

I have tried both of them, neither of them worked.
 
no, you need to seperate it out in different parameters. IN operator works
with variable number of arguments. when you try with parameter in it, it
treated as one argument.

Rajesh Patel
 
Hi,
The way you did is the same way as I did. However, I have
tried your way. still didn't work
 
For what it's worth, this does not work in SQL Server either. The problem
is, the query compiler needs to have the value of the IN clause at compile
time to construct a meaningful query plan. In SQL Server, you can build the
SQL on the fly or create an "EXEC" query that takes a string and builds the
procedure on the fly (on the server).

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top