ADO.NET2.0分页

 SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=Northwind;Integrated Security=True");
            SqlCommand comm = conn.CreateCommand();
            SqlDataAdapter adape = new SqlDataAdapter(comm);
            comm.CommandText = "select * from employees;select * from orders";
            comm.CommandType = CommandType.Text;
            DataTable[] dts = new DataTable[2];
            dts[0] = new DataTable();
            dts[1] = new DataTable();
            DataSet ds = new DataSet();
            //DataTable dt = new DataTable("aaa");
            //DataTable dt1 = new DataTable("bbb");
            //ds.Tables.Add(dt);
            //ds.Tables.Add(dt1);
            //adape.Fill(ds, i, 5, "aaa");
            adape.Fill(ds, i, 5, "");
            //adape.Fill(i, 30, dts[0], dts[1]);
            MessageBox.Show(ds.Tables[1].Rows.Count.ToString());
            i = i + 5;
            this.dataGridView1.DataSource = ds.Tables[0];
            this.dataGridView1.Refresh();

posted on 2006-11-15 12:40  戴玮  阅读(234)  评论(0编辑  收藏  举报

导航