更新时间:2022-12-12 14:15:43
使用逗号连接下拉列表中选择的所有值。然后将此连接值传递给存储过程中的参数。在查询中分配此参数如下
选择 * 来自< table_name> 其中< column_name> ( @ parameter )< / column_name>< / table_name>
希望这有帮助
声明 @ var varchar ( 200 )= ' ''rs001'','' am001'''
Exec (' 从Emp_Master中选择*,其中empcode为IN(' + @ var + ' )')
试试这个,希望它会帮助你!
这是一篇很棒的文章来做你想要的。
多选-下拉一览中-ASP-NET
hii all
i am facing a problem with my project..
i want to selected multiple items from dropdown list and pass these multiple selected value in sql stored procedure in asp .net c#..
please give me idea to solve my problem..
yet i have no coding fro that.. i have no idea how to solve this problem
thanks to all..
Concatenate all the values selected in the Dropdown using comma. Then pass this concatenated value to the parameter in the stored procedure. In the query assign this parameter as below
Select * from <table_name> Where <column_name> in (@parameter)</column_name></table_name>
Hope this helps
declare @var varchar(200)=' ''rs001'',''am001'' ' Exec ('select * from Emp_Master where empcode IN (' + @var + ')')
Try This one , Hope it will help you!
Here is a great article to do what you are asking.
Multi-select-Dropdown-list-in-ASP-NET