是不是你的字段名写错了? <asp:DataList id="DataList1" style="Z-INDEX: 102; LEFT: 292px; POSITION: absolute; TOP: 234px" runat="server">
<AlternatingItemTemplate>
<%# DataBinder.Eval(Container.DataItem,"city","${0}")%>
</AlternatingItemTemplate>
</asp:DataList>
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection cnn = new SqlConnection("server=(local);database=pubs;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select * from authors", cnn);
DataSet ds = new DataSet();
da.Fill(ds);
//DataGrid1.DataSource = ds;
//DataGrid1.DataBind();
DataList1.DataSource=ds;
DataList1.DataBind();
}这样的程序 在我机上可以用:)
<AlternatingItemTemplate>
<%# DataBinder.Eval(Container.DataItem,"city","${0}")%>
</AlternatingItemTemplate>
</asp:DataList>
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection cnn = new SqlConnection("server=(local);database=pubs;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select * from authors", cnn);
DataSet ds = new DataSet();
da.Fill(ds);
//DataGrid1.DataSource = ds;
//DataGrid1.DataBind();
DataList1.DataSource=ds;
DataList1.DataBind();
}这样的程序 在我机上可以用:)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货