在datalist中使用where子句时没有显示任何内容 [英] show nothing on using where clause in datalist
本文介绍了在datalist中使用where子句时没有显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在datalist中使用where子句时没有显示任何内容,在where子句上使用session。
i无法理解哪里是m fault,如果我正在使用session,那么任何数据都没有显示在输出中.. 。
这是我的代码
Show nothing on using where clause in datalist , using session on where clause.
i am unable to understand that where is m fault, if i m using session so any data is not showing in output...
This Is my code
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
<br />
image1:
<asp:Image ID="image1Label" runat="server" ImageUrl='<%# Eval("image1") %>' Height="250px"
Width="225px" />
<br />
FirstName:
<asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ModelsProfileConnectionString %>"
SelectCommand="SELECT * FROM [Pictures] WHERE ([FirstName] = @FirstName)">
<SelectParameters>
<asp:SessionParameter Name="FirstName" SessionField="FirstName" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
推荐答案
ConnectionStrings:ModelsProfileConnectionString %> < span class =code-attribute>
< span class =code-attribute> SelectCommand = SELECT * FROM [图片] WHERE([FirstName] = @FirstName) >
< SelectParameters >
< asp:SessionParameter 名称 = FirstName SessionField = FirstName 类型 = 字符串 / >
< / SelectParameters >
< / asp :SqlDataSource >
ConnectionStrings:ModelsProfileConnectionString %>" SelectCommand="SELECT * FROM [Pictures] WHERE ([FirstName] = @FirstName)"> <SelectParameters> <asp:SessionParameter Name="FirstName" SessionField="FirstName" Type="String" /> </SelectParameters> </asp:SqlDataSource>
这篇关于在datalist中使用where子句时没有显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文