开发者

in the default ASP.NET project created using VS2010, where is |DataDirectory| set?

I see the following connection string in the default web.config:

connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"

I'm at the point when I want to change the connection string, but I cannot find where |DataDirectory| is set. I know it's pointing to a folder called App_Data under the root of my role, where the file aspnetdb.mdf is located.

Looking at this page: http://social.msdn.micros开发者_如何转开发oft.com/Forums/en-US/sqlce/thread/dc31ea59-5718-49b6-9f1f-7039da425296/

it states that the SetData method is used to set the location; however I searched the entire solution and I cannot find a SetData call, or another reference to |DataDirectory|. It also states that as a default it uses the application folder; however I know that is not true since the file is located under the App_Data folder.

Any suggestions where it is set/where I should call the SetData method to set it? The first part is mroe helpful since it's a mystery to me atm :P

Thanks.


App_data Folder is Used for Storing the Local Database, you can Check this site for information project structure

To set The data, You can use AppDomain class : appDomain class

and this example may help you to understand easily App domain example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜