in

System.Data.SQLite

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

problem finding database file (probably user error, not bug)

Last post 01-04-2007 12:10 PM by phendric. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-04-2007 11:31 AM

    problem finding database file (probably user error, not bug)

    Hi,

    I've been developing a small database application for my PDA (WM5) using VS2005 standard (specifically Visual Basic) and SQL Server Mobile.

    However, upon reading about SQLite, and reading that most everything about it, for small databases, is smaller and faster on a handheld than SQL Mobile, I decided I'd try SQLite out.

    I downloaded and installed the 1.0.38.0 version of the SQLite .MSI package from this site.  I created a new VB project, created a new SQLite database, added a simple table to it (with a few sample rows of data), created a dataset in the application from the database, and then created a datagrid on the default form to simply display the contents of the table (a TableAdapter & BindingSource were automatically created).

    All of that worked well.  However, when I went to debug the program, VS downloaded it to my PDA along with the system.data.DQLite.dll library, tried to run it, and it exited with the error that it could not find the DB file to open.  Even when I copied the database file to the installation directory, I got the same error.

    I'm sure this is not a bug, but rather a user error.  Could anyone point out to me what's going wrong and why the EXE can't find the DB file?

    Thanks,
    Phillip
  • 01-04-2007 11:56 AM In reply to

    Re: problem finding database file (probably user error, not bug)

    What's your connection string look like?  Remember that PDA's dont have any concept of a relative directory -- so if your connection string says something like "Data Source=mydb.db" then its going to look in the root \ directory for your database.  You can use the special |DataDirectory| keywork in the connection string which will resolve at runtime to your app's directory, like so:

    "Data Source=|DataDirectory|mydb.db"

    Robert

     

  • 01-04-2007 12:10 PM In reply to

    Re: problem finding database file (probably user error, not bug)

    Ah, yes.  I thought it might be the connection string, as when I checked it, it pointed to the DB file on the desktop.

    I changed it to point to the DB file in the application directory, but forgot to prepend the location with "Data Source=".  I'll try that.

    Thanks, also, for the |DataDirectory| pointer - that should simplify things later on.

    I'll let you know whether it works or not - the project is on my home computer, and I'm at work.

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