日期:2014-05-17  浏览次数:20711 次

gridview显示不出内容,求教~~急~~
public partial class WebForm1 : System.Web.UI.Page
    {
        static string conString = ConfigurationManager.ConnectionStrings["sql"].ConnectionString;
        static SqlConnection conn = new SqlConnection(conString);
        static SqlCommand comm = new SqlCommand("", conn);
        static SqlDataAdapter da = new SqlDataAdapter(comm);
        protected void Page_Load(object sender, EventArgs e)
        {
            comm.CommandType = CommandType.Text;
            comm.CommandText = "select * from goods";
              DataSet ds = new DataSet();
            da.Fill(ds, "Goods");
            gv1.DataSource = ds.Tables["Goods"];////为gv1控件设置数据源为dt
            gv1.DataBind();
            //gv1_Refresh1();
        }
     }
gridview显示不出内容

------解决方案--------------------
你没有设这个AutoGenerateColumns="true"
------解决方案--------------------
不知你GridView页面上有没有设置相应的绑定数据,最好把前后台的代码贴出来.