速度结贴,高手进,求个解释!
OleDbConnection MyConn;
         GetContent getgg = new GetContent();//1.GetContent说明
         OleDbDataReader drgg = getgg.GetGg();//2.这个是临时存放吗?
         GridView1.DataSource = drgg;
         GridView1.DataBind();
         drgg.Close();
         //以上不能独立运行 为什么?
         GetContent getlink = new GetContent();
         OleDbDataReader drlink = getlink.GetLink();
         GridView2.DataSource = drlink;
         GridView2.DataBind();
         drlink.Close();
         MyConn = DB.CreateDB();
         MyConn.Open();
         OleDbCommand cmd = new OleDbCommand("select top 7 * from sale_net", MyConn);
         DataSet ds = new DataSet();
         OleDbDataAdapter oda = new OleDbDataAdapter(cmd);
         oda.Fill(ds, "sale_net");
         this.GridView3.DataSource = ds.Tables["sale_net"].DefaultView;
         this.GridView3.DataBind();
         MyConn.Close();
//能让GridView1独立运行就可以了
------解决方案--------------------datareader是打开数据库,有while循环一条一条读出来的.(长时间占用数据库)
dataset 是直接把所有数据复制到内存中的.
------解决方案--------------------datareader只是一个前向遍历器而已,并不是数据源
------解决方案--------------------GetContent 应该是里面含有OleDbCommand,并用GetGg()返回datareader了