in

System.Data.SQLite

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

SQLiteException: Unable to open the database file

Last post 05-21-2008 10:27 PM by snikolaidis. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-21-2008 2:00 AM

    • snikolaidis
    • Not Ranked
    • Joined on 05-21-2008
    • Thessaloniki, Greece
    • Posts 2

    SQLiteException: Unable to open the database file

     Hi, I'm working on a vb.net application for PPC (Visual Studio 2008), with SQLite DB files and I have a problem on creating a master/detail form.

    I have created a dataset file (xsd) containg a single table. I also created a form containg a DataGrid, which is connected with the dataset through a BindingSource component.

    And in the sub MyForm_Load, there is the following code:


    Me.MyTableAdapter.Fill(Me.DataSetMyData.mytable)


    Everything is just ok.

    Afterwards, I added a second table in the dataset file, for master/detail relationship. And a second DataGrid on the form, which I connected with the dataset and the second table. And the following code was added on the _LOAD sub:

     

    Me.MyNewTableAdapter.Fill(Me.DataSetMyData.mynewtable)


    When I'm executing the application, a SQLiteException is raised in the dataset file on the following code:

    Public Overloads Overridable Function Fill(ByVal dataTable As DataSetMyData.mynewtableDataTable) As Integer
      Me.Adapter.SelectCommand = Me.CommandCollection(0)
      If (Me.ClearBeforeFill = true) Then
        dataTable.Clear
      End If
      Dim returnValue As Integer = Me.Adapter.Fill(dataTable) <- EXCEPTION RAISED
      Return returnValue
    End Function



    The exception that is raising on the second table is the following:

    SQLiteException: Unable to open the database file

    at System.Data.SQLite.SQLite3.Open()
    at System.Data.SQLite.SQLiteConnection.Open()
    at System.Data.Common.DbDataAdapter.QuietOpen()
    at System.Data.Common.DbDataAdapter.FillInternal()
    at System.Data.Common.DbDataAdapter.Fill()
    at System.Data.Common.DbDataAdapter.Fill()
    at MyApplication.PDA.DataSetMyDataTableAdapters.mynewtableTableAdapter.Fill()
    at MyApplication.PDA.FormMyData.FormMyData_Load()
    at System.Windows.Forms.Form.OnLoad()
    at System.Windows.Forms.Form._SetVisibleNotify()
    at System.Windows.Forms.Control.set_Visible()
    at System.Windows.Forms.Control.Show()
    at MyApplication.PDA.Form1.btnTest_Click()
    at System.Windows.Forms.Control.OnClick()
    at System.Windows.Forms.Control.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at MyApplication.PDA.Form1.Main()



    I did a test application for windows (win32 platform) and it seems to work just fine!!!

     

    What's going wrong?

     

    Thank you in advance.

    Stratos Nikolaidis
    Thessaloniki, Greece
    Filed under: ,
  • 05-21-2008 6:21 AM In reply to

    Re: SQLiteException: Unable to open the database file

     What is your connection string?  Is the database file specified in the connection string accessable to the application?

  • 05-21-2008 10:27 PM In reply to

    • snikolaidis
    • Not Ranked
    • Joined on 05-21-2008
    • Thessaloniki, Greece
    • Posts 2

    Re: SQLiteException: Unable to open the database file

    My connection string? Ok... it's the following:

     

    data source=C:\myApp.data\master_data.db

     

    The file is accessable to the application, since I do see one-table-data on several forms, the problem is when I'm trying to add a second dataset on a form..

    Stratos Nikolaidis
    Thessaloniki, Greece
Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems