Solved

Connection strings in ASP.net woith Access

Posted on 2011-03-22
3
439 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

25 Experts available now in Live!

Get 1:1 Help Now