Solved

Connection strings in ASP.net woith Access

Posted on 2011-03-22
3
442 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
ID: 35193325
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
ID: 35193345
Sorry mistype :
<add name="WhatEverNameYouWant" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|GC.accdb;"  />

0
 

Author Closing Comment

by:murbro
ID: 35193436
Thanks very much
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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