Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

after I use the openfiledialog I cannot connect to my database

Posted on 2008-11-11
1
Medium Priority
?
212 Views
Last Modified: 2012-05-05
I am using vb.net 2008 express after I use the openfiledialog when I try to connect to a database it throws an error and says
The database file cannot be found. Check the path to the database. [ Data Source = Database1.sdf ]
I have found similar problems when trying to load rtf files it seems the computer gets paths confused can anyone explain to me what is happening
0
Comment
Question by:Dov_B
1 Comment
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 22934359
Always specify the full path to any files you wish to open.

Using the OpenFileDialog changes the Current Directory, thereby causing "Database1.sdf" to no longer point to the installation directory.

To make it easier, you can use My.Application.Info.DirectoryPath to return the installation directory path.

Wayne
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Loops Section Overview
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question