in

System.Data.SQLite

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

strange Error : no such table : ....

Last post 01-18-2008 5:35 AM by indiekiduk. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-17-2006 2:51 AM

    strange Error : no such table : ....

    hi to all,


    i have a very strange error:
    the ado provider works fine till i add a filedialog to my form.
    i have a form with textboxes. i bind these to dataset.
    But after i add a filedialog to my form, start the app, select a file with the dialog
    press save to commit to sqlite3, i got

    "SQLite error no such table: foo SQLiteException caught."

    after this exception i cant open a connection any more. i need to start the app again.
    the table exist of course. but this happens only when i select a file with a filedialog.

    Someone has the same error?


  • 09-17-2006 8:33 AM In reply to

    Re: strange Error : no such table : ....

    If you are closing and opening a connection, and the connection string contains a relative path to the database, and you are using the Open File dialog, then the problem is that the Open File dialog is changing your CurrentDirectory and the database's relative path no longer points to the same place it was pointing when the application first started.

    You can change your connection string to "Data Source=|DataDirectory|mydatabase.db" instead, and |DataDirectory| will be switched at runtime to your application's designated data directory, or if none was configured, the application's folder.

    Robert

     

  • 09-17-2006 9:30 AM In reply to

    Re: strange Error : no such table : ....


    thx a lot for fast reply and solution.
    i tested it, and it works i am so happy, bcause i thought i did
    a mistake and spend this weekend to find the bug.
    thanx a lot again.Thats a waste of time.

    its quite simple the path, i try

    Data Source=" + Path.GetDirectoryName(Application.ExecutablePath)" + Databasename

    and it works.

    Why does the path change at runtime thru the filedialog?


    thuy
  • 09-17-2006 9:36 AM In reply to

    Re: strange Error : no such table : ....


    Suggestion

    i forgot to suggest, that the exception maybe
    told me that the database didnt exist. So I and maybe other mates
    would better find the bug.


    greets

    thuy

  • 09-17-2006 7:57 PM In reply to

    Re: strange Error : no such table : ....

    I don't really know why the file dialog changes the current directory -- IMO it's a bug in .NET, but apparently the file dialog was designed that way for some ridiculous reason.

    Robert

     

  • 01-18-2008 5:35 AM In reply to

    • indiekiduk
    • Top 200 Contributor
    • Joined on 09-08-2006
    • Glasgow, Scotland
    • Posts 7

    Re: strange Error : no such table : ....

    Should I really be going into the dataset code behind file and editing the path to make it use the relative magic word? [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] private void InitConnection() { this._connection = new global::System.Data.SQLite.SQLiteConnection(); this._connection.ConnectionString = "data source="|DataDirectory|db.s3db""; }
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems