Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / August 2008

Tip: Looking for answers? Try searching our database.

Error when using |DataDirectory| in connection string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carlos - 01 Aug 2008 15:43 GMT
Hi all,

I wanted to have the genereic |DataDirectory| token in the
connection string so that at deployment time I do not need
to know where the application is. When debugging, I saw in text visualizer
that my connection string was :

Data Source = |DataDirectory|\MyDB.sdf;

which I though it was Ok. However, I got the exception:

The path is not valid. Check the directory for the database. [ Path =
|DataDirectory|\MyDB.sdf ]

What did I do wrong?

Thanks for any help.

   Carlos.
Simon Hart [MVP] - 09 Aug 2008 19:26 GMT
I don't know what you mean by |DataDirectory| token but usually for this
kind of thing you'd use the special folder constants within the framework.
This is true for devices as well as desktop operating systems.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com

> Hi all,
>
[quoted text clipped - 15 lines]
>
>    Carlos.
Laxmi Narsimha Rao Oruganti [MSFT] - 13 Aug 2008 12:54 GMT
1) |DataDirectory| is not supported on .NET CF.  It is available only on .NET FX.  
2) Read this thread for more details.

Thanks,
Laxmi

>I don't know what you mean by |DataDirectory| token but usually for this
> kind of thing you'd use the special folder constants within the framework.
[quoted text clipped - 23 lines]
>>
>>    Carlos.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.