ASP.net 2.0 has a special directory app_data, usually the SQL Server, express data file is placed in this directory, the corresponding database connection string is:
Connectionstring= "... data source=./sqlexpress;integrated Security=sspi; attachdbfilename=| Datadirectory|data.mdf; User Instance=true "
Here's a DataDirectory macro, what does he mean?
DataDirectory is a replacement string that represents the database path. Because there is no need to hard-code the full path, DataDirectory simplifies the sharing of the project and the deployment of the application. For example, you do not need to use the following connection string:
"Data source= c:/program files/myapp/app_data/mydb.mdf"
By using | Datadirectory| (included in the vertical bar shown below), you can have the following connection string:
"Data Source = | Datadirectory|/mydb.mdf "
Here's an article working with the local databases detailing the meaning of datadirectory, not only in SQL Server Express, but also in other file databases. For example, the connection string for a sqllite database file:
<add name= "Defaultdb"
Connectionstring= "Driverclass=nhibernate.driver.sqlite20driver;dialect=nhibernate.dialect.sqlitedialect;data source=| Datadirectory|/data.db3 "/>