Solved

Connection strings in ASP.net woith Access

Posted on 2011-03-22
3
436 Views
Last Modified: 2012-06-21
Hi
In my ASP.net project I have the following connection string in my Web.config file:
 <add name="WhatEverNameYouWant" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database\GC.accdb;"  />

I then use the following VB code to update the connection
        Dim cs As String = ConfigurationManager.ConnectionStrings("WhatEverNameYouWant").ConnectionString
        cs = cs.Replace("Database\GC.accdb", Server.MapPath("Database\GC.accdb"))

This all works fine for the \Database\GC.accb online but where should I put my Access database for this to work when debbugging too. In which folder of my project
0
Comment
Question by:murbro
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
Put it in the APP_Data folder you can then use the following connection string:

<add name="WhatEverNameYouWant" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[DataDirectory]GC.accdb;"  />

0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
Comment Utility
Sorry mistype :
<add name="WhatEverNameYouWant" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|GC.accdb;"  />

0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks very much
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now