in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

database not found

Last post 12-29-2007 11:02 AM by Robert Simpson. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-14-2007 6:38 PM

    database not found

    Hi Robert

        I use your product for my application.

        My connection string us like this "Data Source=pub.s3db;New=True;UTF8Encoding=True;Version=3;Pooling=True".  At first query to the database. It was perfectly no problem. But when I open new file using the open dialog/save dialog ( the environment path/current was change ). Then when I try to access again the db, the provider cannot find the db.  

    If my connection string is like this "Data Source=c:\pub.s3db;New=True;UTF8Encoding=True;Version=3;Pooling=True" where the db path was specified. I was perfectly fine. No problem even if I open/save or change the current path.

                May be I will just set the environment.currentpath to my appdomain.basedirectory.

        breeze

  • 12-29-2007 11:02 AM In reply to

    Re: database not found

    If you don't specify a full path to the database in the connection string, then the current directory is used to locate the database.

    So naturally if you change the current directory it won't be able to find the database the next time you try and open the connection.  Use

    "Data Source=|DataDirectory|pub.s3db;New=True;UseUTF16Encoding=True;Version=3;Pooling=True"

    That way it'll use your application's base directory (or whatever you define in your environment as your data directory).

    Robert

     

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems