Where Is DataDirectory ?

Sep 6, 2006

Hello,

I see that one of the new features of SSEv is DataDirectory support.

Where is DataDirectory pointing to? Is it the same directory as the program ".exe" file?

Thank you

Tom



View 16 Replies


ADVERTISEMENT

What Is The DataDirectory In @Data Source = |DataDirectory|Northwind.sdf?

May 9, 2007

hi,
In the SQL Server 2005 Compact Edition demo, I saw the thing like this:

con = new SqlCeConnection(@"Data Source = |DataDirectory|Northwind.sdf");

What does the |DataDirectory| means? Is it like marco or something? Does it work on windows?

I tried it on windows app, in debug window, it does not change to the real data directory.

Thanks

View 7 Replies View Related

SQL Compact And |DataDirectory|

Jun 28, 2007

I am trying to make an asp.net application that will run from the SQL Compact database.

To deploy the application we changed from a full path Data Source="C:inetpubappasdf.sdf"
to
Data Source="|DataDirectory|asdf.sdf"

This returns:
Illegal Character in Path

So I switched to having VS make the path for me
Data Source=".App_Dataasdf.sdf"
and got
The path is not valid. Check the directory for the database. [ Path = .App_DataPDQ_Test_CE.sdf

Is there ANYWAY to use a relative path for the SQL Compact Connection string?

View 6 Replies View Related

DataDirectory Full Vs. Virtual Path

May 3, 2008

Hi

I am having some problems figuring out how the SSCE database connection string is set correctly in a forms application.

I have a database file, Database1.sdf, in the main directory of the application. I can add records to that via VS server explorer no probs. When I use any of the following connection strings in app.config..


Data Source ="|DataDirectory|Database1.sdf"

Data Source =".Database1.sdf"

Data Source ="Database1.sdf"

It will databind to a gridview of a combobox fine. However, when I create a form with some textboxes, build an insert string and use any of those connection strings with "Properties.Settings.Default.Database1ConnectionString" it just does nothing. No errors, no records inserted, just nothing.

But, if I change the connection stirng to...

Data Source ="D:\path\to\my\application\directory\Database1.sdf" (Just so happens I have this application on a D drive)

It all works just fine, including the insert.

So how do I refer to the database with virtual vs. absolute path? As far as I can tell the very first connection string I used should work, and should publish with the application.

Thanks!

View 3 Replies View Related

|DataDirectory| - Minor Issue SQLev

Oct 16, 2006

It seems that the |DataDirectory| macro is giving VS 2005 fits. It's a minor issue though and I've stumbled on it recently.

The issue actually doesn't come up until you try to "add a new data source" to your project (after you've made the modification in your app settings/Project Properties to use the macro). So if you started of with ".something.sdf" and then changed it to use the macro, things do run fine....until you try to add a new datasource (new database datasource)

The error is: "Illegal characters in path" which is the pipe symbol.....

While on this subject, here's a tip to those who maybe going through some debugging mysteries:

Even if your sdf file is in your app "root" folder, if you debug, the file your app is actually working on is in the "indebug" folder. So it pays to create another connection in your Server Explorer to this file while debugging.

I spent quite some time trying to figure out why my code didn't seem to be working and got even more frustrated since obviously no errors were reported. Turns out I was looking at the wrong db file....hope this helps...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved