Filter expression in Sqldatasouce

2019-08-06 19:01发布

I have a sqldatasource where i have added a simple filter expression just for testing

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT * FROM [project_details]" 
                FilterExpression="id=33" 
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                EnableCaching="True">

and a grid view in update panel which has datasource as sqldatasouce1 . but on executing this page grid view is showing all the result withour any filtering . please help me i am totally struck here

1条回答
爷的心禁止访问
2楼-- · 2019-08-06 19:55

If the id is stored in text format then you might want to give single quotes in the expression as shown here:

id='33'

查看更多
登录 后发表回答