在where子句中传递多个值
好的........
在窗口形式中,我有3个不同的2个条件来过滤数据,我有3个cheakesdlistbox(第1个为partyname,第2个为交换类型,第3个为itemname)每个都包含用户选择(通过颊颊检查框)选择的项目数当事人名称,现在他选择可用交换类型的2个交换类型,并且在第三个名称中,他可以现在选择所有项目或总和,因为他按显示按钮数据时应使用上述选择在datagridview中填写.........现在我想在whare子句中传递这些选定的值..like..whrerepartyanme =来自partyname的所有值"和exchangetype =所有选定的交换类型"和itemname =选定的项目名称" ....
请帮助我如何编写具有多个选定值的selct查询....
C#.sqlserver
感谢高级
lakhan
ok........
in window form i have three different-2 criteria to filter data for thre i have three cheakesdlistbox(1st for partyname .2nd for exchange type and 3rd one for itemname) each contain number of items let if user select(by cheeking cheak box) 10 party name now he select 2 exhange type of the available exchange type and in third ithemname may he select all item or sum now as he press show button data should be fill in datagridview with the above selection .........now i want to pass these selected values in whare clause ..like..whrere partyanme="all value from partyname" and exchangetype="all selected exhange type"and itemname="selected itemname"....
please help me how to write selct query with multiple selected values....
C#.sqlserver
thanks in advanced
lakhan
您的查询必须如下所示:
Your query must look like this:
CREATE PROCEDURE spGetDetails
@exchangetype varchar(50),
@partyname varchar(50),
@itemname varchar(50)
BEGIN
SELECT * FROM [tablename] WHERE exchangetype = @exchangetype
AND partyname=@partyname
AND itemname=@itemname
END
您需要将C#中的值作为参数传递给SQL存储过程.
问候,
爱德华
You need to pass the values from C# as parameters to your SQL Stored Proc.
Regards,
Eduard