Connection String problems for Access Database

Has it ever happen that you have made the Access database connection and it worked on your local machine and blows on the development server? I am using the connection string in two parts take a look at the code below: 

 <appSettings>
 <
add key="ConnectionString" 
 
value="Provider=Microsoft.Jet.OLEDB.4.0;
 User Id=admin;Password=;Data Source=" />
 <
add key="ConnectionPath" value="/Database/MyDatabase.mdb" />
  </appSettings>  

And here is the C# code that combines and build up the connection string.

// generates the connection string 
private string GenerateConnectionString() 
{
string provider = (string
ConfigurationSettings.AppSettings["ConnectionString"];
string path = (string) ConfigurationSettings.AppSettings["ConnectionPath"]; 
string connectionString 
= provider + HttpContext.Current.Server.MapPath("~/"+path); 
//string connectionString = provider + path;     
return connectionString; 

Hope it helps!  

       

powered by IMHO 1.3

Print | posted @ Friday, February 17, 2006 11:19 PM

Twitter