过滤表达式或条件不是工作 [英] filter expression with or condition is not workng

查看:77
本文介绍了过滤表达式或条件不是工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的问题是我在gridview中使用带有运算符的两个控制参数的过滤器表达式。但是或者运营商没有工作?



我的意思是我必须填写文本框控件然后数据显示,否则默认gridview显示。



我的代码是



Hi,

My problem is I am using filter expression in gridview with two control parameters with or operator. But or operator is not working ?

I mean i have to fill both textbox control then data display otherwise default gridview is showing.

My code is

<asp:SqlDataSource ID="SqlDataSource2" runat="server"

                            ConnectionString="<%$ ConnectionStrings:hospital %>"

                            DeleteCommand="DELETE FROM [Purchaseentry] WHERE [Billno] = @Billno"

                            SelectCommand="SELECT * FROM [Purchaseentry]  " FilterExpression="Convert(bill , 'System.String') LIKE '{0}%' OR itemname Like '{1}%'"

                            UpdateCommand="StoredUpdatepurchase" UpdateCommandType="StoredProcedure"

                              >
                            <FilterParameters>
                               <asp:ControlParameter Name="bill" ControlID="txtSearch" PropertyName="Text" ConvertEmptyStringToNull="true"   />
                                  <asp:ControlParameter Name="itemname" ControlID="txtitemname" PropertyName="Text" ConvertEmptyStringToNull="true"   />

                           </FilterParameters>

推荐答案

ConnectionStrings:hospital %>

< span class =code-attribute> DeleteCommand = DELETE FROM [Purchaseentry] WHERE [Billno] = @Billno

< span class =code-attribute> SelectCommand = SELECT * FROM [Purchaseentry] FilterExpression = 转换(bill,'System.String')LIKE'{0}%'或itemname类似'{1}%'

UpdateCommand = StoredUpdatepurchase UpdateC ommandType = StoredProcedure

< span class =code-attribute> < span class =code-attribute> >
< < span class =code-leadattribute> FilterParameters >
< asp:ControlParameter 名称 = bill ControlID = txtSearch PropertyName = 文字 ConvertEmptyStringToNull = true / >
< asp:ControlParameter 名称 = itemname ControlID = txtitemname < span class =code-attribute> PropertyNa我 = 文字 ConvertEmptyStringToNull = true / >

< / FilterParameters >
ConnectionStrings:hospital %>" DeleteCommand="DELETE FROM [Purchaseentry] WHERE [Billno] = @Billno" SelectCommand="SELECT * FROM [Purchaseentry] " FilterExpression="Convert(bill , 'System.String') LIKE '{0}%' OR itemname Like '{1}%'" UpdateCommand="StoredUpdatepurchase" UpdateCommandType="StoredProcedure" > <FilterParameters> <asp:ControlParameter Name="bill" ControlID="txtSearch" PropertyName="Text" ConvertEmptyStringToNull="true" /> <asp:ControlParameter Name="itemname" ControlID="txtitemname" PropertyName="Text" ConvertEmptyStringToNull="true" /> </FilterParameters>







请查看此链接。

这对你有帮助。

http://bytes.com/topic/asp-net/answers/455665-gridview -convert-data-type-filterexpression [ ^ ]


这篇关于过滤表达式或条件不是工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆