Sunday, February 12, 2012

AttachDbFilename in DbNameDataSet.xsd

How can I use AttachDbFilename in DbNameDataSet.xsd to access the database in the same directory as the exe file (i.e. the application using it)?Use Application.StartupPath to get the directory your program is in.
To get the complete filename to your mdf file, use:



string filename = System.IO.Path.Combine(Application.StartupPath, "filename.mdf");

|||Thank you but my mistake. I failed to mention it is C++ program. What you wrote appears to be VB. Tho I will add it to my VB code snippets.|||

Actually, it's C#. However, it should work with any .NET language.

No comments:

Post a Comment