日期:2014-05-18 浏览次数:20894 次
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\\txl.mdb"); con.Open(); string sql = "select * from stuff"; OleDbDataAdapter da = new OleDbDataAdapter(sql, con); ds = new DataSet(); da.Fill(ds, "stuff");//填充到ds dataGridView1.DataSource = ds.Tables["stuff"];
------解决方案--------------------
DataSet dataset = new DataSet();
OleDbConnection conn = new OleDbConnection(connection);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(query, conn);
adapter.Fill(dataset);
------解决方案--------------------
你用DataSet去接数据就行了
需要你手动封装吗