完整的代碼 如下
DataGrid
DataGrid
一定要在ds
<%@import namespace=
<%@import namespace=
<script language=
string connstr=ConfigurationSettings
//小區信息
string sql=
//交換機信息
string sqltext=
private void page_load(Object obj
{
if(!Page
{
Dataload();
}
}
private void Dataload()
{
try
{
OleDbConnection conn=new OleDbConnection(connstr);
DataSet ds=new DataSet();
OleDbDataAdapter da=new OleDbDataAdapter(sql
da
DataView dv=new DataView(ds
OleDbDataAdapter da
da
ds
DataGrid
DataGrid
conn
}
catch(OleDbException ex)
{
info
}
}
</script>
<html>
<body>
<form runat=server>
<asp:DataGrid id=
<Columns>
<asp:TemplateColumn HeaderText=
<ItemTemplate>
<%# DataBinder
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText=
<ItemTemplate>
<asp:Repeater id=
<ItemTemplate>
<%# Container
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</form>
<asp:label id=
</body>
</html>
From:http://tw.wingwit.com/Article/program/net/201311/11177.html