Solved

open connection string with data.mdf in appdata folder

Posted on 2010-08-13
2
846 Views
Last Modified: 2012-05-10
this is my connection string
<connectionStrings>
    <add name="EnergyConnectionString3" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\hhhhhhh\Desktop\energy\App_Data\databasename.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>

and it works fine but how do i shorten the path can i say just app_data/databasename.mdf instead of that whole string so that when i bring it to other computer it works just fine? thanks.
0
Comment
Question by:StewSupport
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 33434679
You should be able to use:

   
<connectionStrings>

    <add name="EnergyConnectionString3" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\databasename.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

</connectionStrings>

Open in new window

0
 

Author Closing Comment

by:StewSupport
ID: 33434847
thanks a million
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

14 Experts available now in Live!

Get 1:1 Help Now