Pass value to parameter

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

Rajesh Patel

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
 
I

isee

Hi,
The way you did is the same way as I did. However, I have
tried your way. still didn't work
 
W

William \(Bill\) Vaughn

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

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