I am building a VB 2008 application that interfaces with a MS Access
database. I wish to change the connection string so It looks in the user’s My Documents folder rather than the current directory.
The problem is that the My Documents directory will be in a different place depending on the user’s OS and setup. Is there a way to code the connection string so that it goes to the my documents directory wherever it may be?
connectionString=”Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\studentSurvey.accdb”
Doing a quick Google search using the following keywords will give you all sorts of good URLs for information:
VB 2008 “My Documents” folder
And here are a few links to start you off with:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vb.database&tid=016a74cc-ec8c-4a37-8f54-3ed9e5f5f8e3&cat=&lang=&cr=&sloc=&p=1
http://dotnetref.blogspot.com/2008/05/finding-my-documents-folder-in-vbnet.html
http://www.thescarms.com/dotnet/SpecialFolders.aspx
http://www.developerfusion.com/code/251/special-folder-paths/
.