本文介绍了在表中显示数据库数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我希望我的数据显示在表格视图中.我在数据库中有一个记录,其中包含1列和sql中的多行.我想在包含3行3列的表格视图中显示它.
i have a question i want my data in table view. I have a recored in database which consist 1 column and multiple row in sql. and i want to display it in table view which consist of 3 row and 3 columns.
<table border="2">
<tr>
<asp:Repeater id="Repeater2" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<td>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Well") %>'></asp:Label>
</td>
</ItemTemplate>
</asp:ListView>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:studentConnectionString %>"
SelectCommand="SELECT * FROM [welcome]"></asp:SqlDataSource>
推荐答案
<table border="2">
<tr>
<asp:repeater id="Repeater2" runat="server" datasourceid="SqlDataSource1" xmlns:asp="#unknown">
<itemtemplate>
<td>
<asp:label id="Label3" runat="server" text="<%# Eval("Well") %>"></asp:label>
</td>
</itemtemplate>
</asp:repeater></tr>
</table>
-----------
Should be
-------------
<asp:repeater id="Repeater2" runat="server" datasourceid="SqlDataSource1" xmlns:asp="#unknown">
<itemtemplate>
<table border="2">
<tr>
<td>
<asp:label id="Label3" runat="server" text="<%# Eval("Well") %>"></asp:label>
</td>
</tr>
</table>
</itemtemplate>
</asp:repeater>
这篇关于在表中显示数据库数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!