<% @ Page language = "c #" contenttype = "text / html" responseEncoding = "gb2312"%>
Void Page_Load () {string db_path = @ "data / db.mdb"; // Put the path change to see the error message String DB = Server.mAppath (db_path); string strsql = "SELECT * from admin"; string connString = "Provider = microsoft.jet.Oledb.4.0; data source =" db; system.data.oledb.oledbdataareader DR; system.data.oledb.oledbconnection conn = null; system.data.oledb.oledbcommand cmd = null; / / ================================================================================================================================================================================================== ====== Try {conn = new system.data.oledb.oledbconnection (connString); cmd = new system.data.oledb.oledbcommand (strsql, conn); cmd.connection.open ();} catch (Exception EX) {conn.close (); response.write ("Connection Was Closed!
" ex.Message); return;} // ================= ====================================== DR = cmd.executeReader (); DataGrid1.datasource = DR; DataGrid1.DATABIND (); conn.close ();
} Script>