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
Loading
Sam HobbsPosted Oct 13, 2011, 4:45 PM
You must use the documentation provided by your shared hosting service. They should tell you what you need for the connection string.
VikramPosted Oct 13, 2011, 4:30 AM
There is no any password I have set for MS Access Database. Whenever I give local path of machine then it is working fine. Now I want to upload this web site on shared hosting server whose path I don't know. So I tried with Server.MapPath() function in above format which didn't work for me.
Hope I have clarify my issue.
Regards,
Vikram Patil
Hemant KumarPosted Oct 13, 2011, 4:09 AM
The Connection String for MS Access can be set as ; And the C# code to connect to MS Access database ; C# Access Connection String OLE DB OleDbConnection password field is the password you set up in access database.