Thursday, March 22, 2012

listbox and sql stored procedure

Hi,
First of all sorry for my not perfect english.
I've got listbox in my .aspx page where the users can make multiple
selection.
So, Users can select 7 items in listbox, I have to take value from items and
pass it to stored procedure to delete 7 rolls in my table. Thats simple,
but what if user select 3 or 30 items in listbox? The problem is that I dont
know the number of the parameters, and how to pass them. can I use array
or is there some different solution?
Of course I can take the collection of items and for every item, I can call
stored procedure, but this is no good in performance reason.
Please help meAre you asking how to pass variable number of values to a stored procedure?
If it is the question, merge all values into one string and parse it in the
stored procedure.
Eliyahu
"John" <stomss2003@.yahoo.com> wrote in message
news:uDp5mcrXEHA.3016@.tk2msftngp13.phx.gbl...
> Hi,
> First of all sorry for my not perfect english.
> I've got listbox in my .aspx page where the users can make multiple
> selection.
> So, Users can select 7 items in listbox, I have to take value from items
and
> pass it to stored procedure to delete 7 rolls in my table. Thats simple,
> but what if user select 3 or 30 items in listbox? The problem is that I
dont
> know the number of the parameters, and how to pass them. can I use array
> or is there some different solution?
> Of course I can take the collection of items and for every item, I can
call
> stored procedure, but this is no good in performance reason.
> Please help me
>
Deep Wrote:
Concatenate the values in a string delimited with some other string like "|"
e.g.1|2|3. Pass this string to a stored procedure. Use charat function to
extract individual numbers and the fire delete statements.
"Eliyahu Goldin" wrote:

> Are you asking how to pass variable number of values to a stored procedure
?
> If it is the question, merge all values into one string and parse it in th
e
> stored procedure.
> Eliyahu
> "John" <stomss2003@.yahoo.com> wrote in message
> news:uDp5mcrXEHA.3016@.tk2msftngp13.phx.gbl...
> and
> dont
> call
>
>

0 comments:

Post a Comment