Vikram

Vikram

  • 1.5k
  • 276
  • 308k

Connection failed with MS Access on Hosting server

Oct 13 2011 2:44 AM
Hi,
 
   I am using MS Access as database for web site. To create connection string I used following code.
       
        string dppath="";
        OleDbConnection MSAConn;

        dbPath = HttpContext.Current.Server.MapPath("~");
        dbPath = dbPath + "\\App_Data\\dbname.accdb";
       
        MSAConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + dbPath + ";");

   Also I have tried ...
       MSAConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
                           HttpContext.Current.Server.MapPath("\App_Data\dbname.accdb") + ";");

  These both connection string doesn't work . I am hosting this application on Shared Hosting Server.

Any help appreciated.

Regards,

  Vikram

Answers (3)