开发者

Pointing a ConnectionString to a special folder via Visual Studio Designer

I'm trying to set a DataAdapter connection string to point to %APPDATA% from within Visual Studio designer by editing the DataAdapter properties. I cannot seem to be able to use that moniker on the connection string property. It doesn't get translated to C:\Users\MyUserName\AppData\Roaming when I then run the application in debug mode.

How can I ensure that these type of strings can be set within the designer so they are not hardcoded and do not jeopardize any future Setup project?

Note: I know how to handle it in code with GetFolderPath(). But is there similar functionality for controls properties and string settings/resou开发者_如何学Gorces in the designer?


The %APPDATA% refers to a special location in your source code folder (.i.e, %csprojectLocation%/AppData for sqlserver, %csprojectLocation% for MS Access). It is not the OS Application Data.

AFAIK there is no special variable that denotes the OS Application Data for dataset designers. So you have to manually set the connection string after you deploy it to your client computer. You can use an installer to do this though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜