Maybe dumb questions, but what is DataDirectory?

B

bz

Hi,

I developed several NET applications with SQL server and Access
databases, and I feel really stupid asking this question, but
everytime I used SQL database name in connection strings or I used a
connection string with placeholders for Access databases, and I
constructed the real path to MDB at runtime, before using it.
However, I saw several time connection strings like

("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\
\example.mdb");

Where this actually points to? What is DataDirectory?

Also, I didn't used SqlServer Express, only real SQL Server (developer
version or production), and I saw in several programs connection
string like this:

connectionString="Data Source=.\SQLExpress;Integrated
Security=True;User Instance=True;AttachDBFilename=|DataDirectory|
Database.mdf;"

What does it do? Attach a sql server database (detached) to a sql
server express instance right in the moment when the connection string
is used? Does this works with full sql server too? I couldn't tested
it since I didn't knew where DataDirectory points to

Thank you
 
P

Paul Clement

¤ Hi,
¤
¤ I developed several NET applications with SQL server and Access
¤ databases, and I feel really stupid asking this question, but
¤ everytime I used SQL database name in connection strings or I used a
¤ connection string with placeholders for Access databases, and I
¤ constructed the real path to MDB at runtime, before using it.
¤ However, I saw several time connection strings like
¤
¤ ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\
¤ \example.mdb");
¤
¤ Where this actually points to? What is DataDirectory?
¤
¤ Also, I didn't used SqlServer Express, only real SQL Server (developer
¤ version or production), and I saw in several programs connection
¤ string like this:
¤
¤ connectionString="Data Source=.\SQLExpress;Integrated
¤ Security=True;User Instance=True;AttachDBFilename=|DataDirectory|
¤ Database.mdf;"
¤
¤ What does it do? Attach a sql server database (detached) to a sql
¤ server express instance right in the moment when the connection string
¤ is used? Does this works with full sql server too? I couldn't tested
¤ it since I didn't knew where DataDirectory points to

It's actually a macro. The following should help:

http://blogs.msdn.com/smartclientdata/archive/2005/08/26/456886.aspx


Paul
~~~~
Microsoft MVP (Visual Basic)
 
C

Cor Ligthert[MVP]

Paul,

Good question because that question I had to, but did not ask it because I
thought it was again a new thing.

:)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top