Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Multiple Values to a Single Parameter
Message
De
21/09/2004 20:39:33
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Passing Multiple Values to a Single Parameter
Divers
Thread ID:
00944810
Message ID:
00944810
Vues:
71
Hi ol!

I need to used the following statement in a stored procedure:

Select * from Fruits where FruitName in ('Apple', 'Banana', 'Coconuts')

Apple, Banana, & Coconut are values that will be supplied by the user using a listbox which allows multiple selection. There is no limit on the number of items that the user can select. It can be 1 or 10 or more. Is there a way I can pass these values into a single paramter so I can use it like:

Select * from Fruits where FruitName in (@Parameter)

I have tried putting all the values in a single variable formated for the IN clause.

x="'Apple', 'Banana', 'Coconut'"

Passing this to the stored procedure generates an error "To many parameters passed!" which is true because when...

cn.Execute("spFruit " & x)

... is evaluated it looks like...

cn.Execute("spFruit 'Apple', 'Banana', 'Coconut'")

... which passed 3 parameters to spFruit which only accepts 1 parameter. Anyone with ideas on how I can tackle this?

Thanx! a lot in advance!!! :)
Shit happens!!!
Répondre
Fil
Voir

Click here to load this message in the networking platform