Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.
I never thought using connection string in web.config for Access database could be so frustrating. Whenever I put the connection string and try to feed it to the connection object it always throws the exeption that the path was not found even though I was using Server.MapPath. The problem was that you cannot feed the whole damn connection string to the map path method since it only takes a PATH and no junk. Hence I have to break it down into pieces. Something like this:
  
  
 
    
And then used the following code to retrieve the path information from web.config.
string provider = (string) ConfigurationSettings.AppSettings["ConnectionString"]; 
			string path = (string) ConfigurationSettings.AppSettings["ConnectionPath"]; 
			string connectionString = provider + HttpContext.Current.Server.MapPath(path); 
Finally it worked and I was a happy man :) Posted on Saturday, July 30, 2005 9:17 PM | Back to top


Comments on this post: Connection String Nightmares in Access Database

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net