SqlDataAdapter da = new SqlDataAdapter("select * from goods", conn); 这里面的sql语句要带查询条件呀

解决方案 »

  1.   

    sql语句你写的是查询goods表中的所有内容   select * from goods where .......
      

  2.   

    DataList 只是一个单纯的数据载体,无法做太多的操作,相对于数据检索,还得在数据源中进行,先把数据源检索,然后再附给DataList,然后才到DataBind(),
      

  3.   

    da.Fill(ds);
     DataList1.DataBind();
    ==》
     DataList1.DataSource=ds.Tables;
     DataList1.DataBind();
      

  4.   

    将textbox里的东西作为条件去查询数据吧。然后在绑定到datalist上