after I use the openfiledialog I cannot connect to my database

Posted on 2008-11-11
Last Modified: 2012-05-05
I am using 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
Question by:Dov_B
    1 Comment
    LVL 46

    Accepted Solution

    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.


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now