set parameter value fail?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, everyone:

I have a store procedure just like:

select name, id from user
where( id in (@id))

When I try to set the parameter (@id) value with multiple id, I always get
error, could anyone tell me how to set the value correctly?

what I have done is:

com1.parameters["@id"].value="1,2,3,";

but the type of this parameter is int.

thanks for your help.

haiwen
 
This very common question has be asked and answered a dozen times over the
last few years...
Basically, you can't do this. There are several alternative approaches
discussed in the archives. Use Google Groups to search ...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
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.
__________________________________
 
Like Bill mentioned, this problem frequently confronts many people. I wrote
an article for the MSDN Knowledge base but I don't think it's been published
yet. However I think this will help you
http://www.knowdotnet.com/articles/temptables.html . Note that this is a
work around and merely gets things to work in spite of themselves. As much
as I hate to say this and even find myself cringing as I type, this is
probably one situation where dynamic Sql may not be that bad of an
alternative depending on your db (Since Access for example doesn't support
temporary tables).

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Back
Top