Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How To Pass Array Parameter From Asp.net To One Parameter In Sql statement???
---------------------------------------------------------------------------

now i wanna to pass array parameter to @id
like the next ex:

VB
Dim arr As New ArrayList
       For Each row As GridViewRow In GridView1.Rows
           arr.Add(row.Cells(0).Text)
       Next
       Session("show_product") = arr
       Response.Redirect("show.aspx")


then i go to ("show.aspx")

and but gridview1 and bind it with sqldataource1 with selectedvalue like that
SQL
select * from table where id in (@id)


but the parameter unable to get ArrayList

in the end i just wanna know what is the data type how is can carry values like
1,2,3,4,5 etc
and this type apple to relapse @id to 1,2,3,4,5
to Sql statement like
SQL
select * from table where id in (1,2,3,4,5)
Posted

1 solution

Set @id datatype to varchar. Use loop on arraylist to get comma separated output. Send this comma separated value as input for @id.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900