sql数据到asp:C#中的表

时间:2014-06-11 08:49:13

标签: c# asp.net sql datatable

我希望该网页连接到SQL数据库,并在表格中显示所选数据。我有一个问题:

select top 5 
    r.remoteid, 
    count(distinct m.mac) as mac,  
    count(distinct i.igmp) as igmp, 
    i.date
from 
    remoteid as r
join 
    dbo.mac as m on m.mazgas = r.mazgas and m.portas = r.portas 
join 
    dbo.igmp as i on i.mazgas = m.mazgas and i.portas = m.portas and i.date = m.date
where  
    i.date = DATEADD(day, datediff(day, 0, getdate()), -1)
group by 
    r.remoteid, r.mazgas, r.portas, m.vlan, m.date, i.date
order by 
    igmp desc

在HTML(<asp:Table ID="Table1" runat="server"></asp:Table>)中将返回值填充到asp:table的最佳方法是什么。

表格应如下所示:

remoteid     date  
 remote    mac|igmp

谢谢。

1 个答案:

答案 0 :(得分:0)

<asp:Table>不是数据控件。您必须使用<asp:GridView>