0
我的數據庫看起來像:的SqlDataSource行
_______________
column1|column2|
name1 | 5 |
name1 | 3 |
name1 | 1 |
name2 | 2 |
name2 | 4 |
````````````````
使用VS 2012和ASP林:DataList和我試圖表現出這樣的數據:
_________________
name1 | 5 | 3 | 1|
name2 | 2 | 4 | |
`````````````````
我試着有很多種方法可以做到這一點:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:finchsize_polibudaConnectionString %>"
SelectCommand="SELECT a1.[przedmiot], a1.[ocena], a2.[ocena] from [oceny] as a1, [oceny] as a2 where a1.[ocena] != a2.[ocena] and a1.przedmiot = a2.przedmiot;">
</asp:SqlDataSource>
<table>
<td>
<asp:DataList ID="DataListOcenyDzieciak" runat="server"
DataSourceID="SqlDataSource1" RepeatColumns="1"
>
<ItemTemplate>
<asp:Label ID="przedmiotLabel" runat="server" Text='<%# Eval("przedmiot") %>' />
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ocena") %>' />
<br />
</ItemTemplate>
</asp:DataList>
</td>
但它沒有奏效。你知道我該怎麼做嗎?
什麼都不起作用?你有錯誤還是隻顯示不正確的值? –