数据库为access示例:
string str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hello.mdb"; using(OleDbConnection con=new OleDbConnection(str)) { string sql="select * from 学生表"; DataSet ds = new DataSet();OleDbDataAdapter da=
new
OleDbDataAdapter(sql,str)
da.Fill(ds); DataTable table = ds.Tables[0]; this.dataGridView1.DataSource = table; }