编程很好玩!
编程很好玩!

导航

 

连接Access数据库

            string strPath = Application.StartupPath + "\\DataBase\\AccessDB.mdb";
            OleDbConnection con = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source='"+strPath+"'");
            OleDbDataAdapter oda = new OleDbDataAdapter("Select * from tb_Student", con);
            DataSet ds = new DataSet();
            oda.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0].DefaultView;

posted on 2009-11-27 13:13  lzp  阅读(485)  评论(0编辑  收藏  举报