本帖最后由 wowchina0752 于 2009-11-20 16:27:12 编辑

解决方案 »

  1.   

    <asp:DataList ID="DataList1" runat="server" Width="484px">
                      <ItemTemplate>
                           <a href="news.aspx?id=<%# Eval("id") %>"><asp:Label ID="Label2" runat="server" Text='<%# Eval("newsname") %>'></asp:Label></a>
                      </ItemTemplate>
                  </asp:DataList>
    这个是前台代码        SqlConnection cons = new SqlConnection(connectionString);
            cons.Open();
            string strsqls = "select id,newsname from news order by id desc";
            sqlda = new SqlDataAdapter(strsqls, cons);
            sqlda.Fill(ds, "news");
            cons.Close();
            dtInfo = ds.Tables[0];        DataList1.DataSource = ds.Tables["news"];
            DataList1.DataBind();这个是后台代码
      

  2.   

    但是其他的页面有也是用datalist做的啊那些页面都可以显示出来
      

  3.   

    会不会是服务器上的news表中没有内容