<% @ Page language = "c #" ContentType = "text / html" responseEncoding = "GB2312"%> <% @ import namespace = "system.data.oledb"%>
Void Page_Load () {string db_path = @ "data / db.mdb"; // Database path string db = server.mappath (db_path); string strsql = "select * from [admin]"; string connString = "provike = Microsoft .Jet.OLEDB.4.0; Data Source = " DB; OleDbConnection conn = new OleDbConnection (connString); // establish OleDbConnection object OleDbCommand cmd = new OleDbCommand (strSQL, conn); // establish OleDbCommand object OleDbDataReader dr; // build DataReader object cmd.connection.open (); // Open link DR = cmd.executeReader (); // Establish DataReader DataGrid1.DataSource = Dr; DatAgrid1.DataBind ()
script> asp: datagrid>