Click here to Skip to main content
15,892,005 members

Response to: How to connect MS access database with ASP.net (language VB)

Revision 1
Hi,


Here is complete working code

string ConnectString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("db\\database.mdb;");
       OleDbConnection objCon;
       OleDbCommand objCmd;
       DataSet Ds = new DataSet();

       string GetSql = string.Empty;
       GetSql = "(SELECT * FROM table)";
       using (objCon = new OleDbConnection(ConnectString))
       {
           using (objCmd = new OleDbCommand(GetSql, objCon))
           {
               OleDbDataAdapter Da = new OleDbDataAdapter(objCmd);
               Da.Fill(Ds);
           }
       }
Posted 17-Jan-11 1:16am by soni uma.
Tags: , ,