开发者

Embed Special Folder in SQL Compact connection string?

开发者 https://www.devze.com 2023-01-16 18:50 出处:网络
I am creating a SQL Compact demo, and I want to point the connection string in my App.config file to %CommonAppDataFolder% (the Special Folder token that points to c:\\ProgramData on Windows 7 machine

I am creating a SQL Compact demo, and I want to point the connection string in my App.config file to %CommonAppDataFolder% (the Special Folder token that points to c:\ProgramData on Windows 7 machines). My current connection string hard-codes the ProgramData folder ref开发者_开发知识库erence:

Data Source=c:\ProgramData\Foresight Systems\SQL Compact Demo\LocalData.sdf

I'd like to change it to something like this:

Data Source=%CommonAppDataFolder%\Foresight Systems\SQL Compact Demo\LocalData.sdf

Obviously, that doesn't work. So, my question is: What is the correct syntax to embed a Special Folder in a connection string? Thanks for your help.


Based on the answer here, I have come to the conclusion that it simply can't be done. If anyone knows of a way to embed a Special Folder token in a connection string in App.config, I'll be happy to change the accepted answer.

0

精彩评论

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