in

System.Data.SQLite

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

Am I going insane?

Last post 07-29-2009 5:31 AM by Knch. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-24-2009 10:19 AM

    • JasonM
    • Not Ranked
    • Joined on 07-24-2009
    • Posts 4

    Am I going insane?

    Hi, I'm trying to get the System.Data.SQLite DBFactory working in a web application.

    I'm using VS2008 Pro and my dev machine is Windows Server 2008 (x64).

    I've downloaded and run the executable file and have design time support for VS2008 - I can access a SQLite database using VS2008. I know I'm using the right .DLL for x64 as I've got another web application that works fine with the DLL.

    I've added the following to the web.config file:-

    <system.data>
        <DbProviderFactories>
          <remove invariant="System.Data.SQLite"/>
          <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
    type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
        </DbProviderFactories>
      </system.data>

    And I've seen the DBFactory references in the machine.config files to be found in c:\windows\microsoft.net\framework\v2.0.50727 and c:\windows\microsoft.net\framework64\v2.0.50727 though I have the 3.5 framework installed anyway so I'm not sure if that has any affect.

    I've tried to read the help files on both Windows Server 2008 and a Vista machine but for some reason I get the error "Navigation to the webpage was canceled" when I try to view any help page on both machines - so I can't refer to the documentation in this case. I'm literally going insane with this. Maybe you know what is coming next, but I'll say it anyway...

    I'm getting that damned error... "Unable to find the requested .NET Framework Data Provider. It may not be installed" I'm reduced to just trying to get the thing to print out onto the screen... here is my code as it is now... although I've tried lots of variations on this...

    string providerName = "SQLite Data Provider";
    string provider = DbProviderFactories.GetFactory(providerName).ToString(); Response.Write(provider);

    this doesn't work either "DbProviderFactory factory = DbProviderFactories.GetFactory("SQLite Data Provider");", or this

    string providerName = "SQLite Data Provider";
    DbProviderFactory provider = DbProviderFactories.GetFactory(providerName);

    Please help if you can... my sanity depends upon it!!!!

    Thanks in advance.

  • 07-24-2009 6:23 PM In reply to

    Re: Am I going insane?

    First, the easiest thing to do to see if the SQLite provider factory is even present on the machine is to call DbProviderFactories.GetFactoryClasses() and look at the returned datatable.

    If SQLite is listed, then there's a configuration problem -- either a CPU type discrepancy or some other issue.  If SQLite isn't listed, then your config is messed up.

    I am assuming you've deployed the System.Data.SQLite library in your bin directory?

     

  • 07-27-2009 5:10 AM In reply to

    • JasonM
    • Not Ranked
    • Joined on 07-24-2009
    • Posts 4

    Re: Am I going insane?

     Hi,

    thanks for the help.  I tried this:-

    string test = DbProviderFactories.GetFactoryClasses().ToString();
    Response.Write(test);

    And just get the text "DbProviderFactories" as the output.  I'm assuming that is bad.  I have put SQLlite in my bin foler and the code I'm trying to run is in the folder just above it.  I'm stuck for other ideas now.

  • 07-27-2009 6:54 AM In reply to

    • JasonM
    • Not Ranked
    • Joined on 07-24-2009
    • Posts 4

    Re: Am I going insane?

    I found some useful code on the MS site which lets me response.write the datatable out to the web page, here is the results...

     Odbc Data Provider
    .Net Framework Data Provider for Odbc
    System.Data.Odbc
    System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    OleDb Data Provider
    .Net Framework Data Provider for OleDb
    System.Data.OleDb
    System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    OracleClient Data Provider
    .Net Framework Data Provider for Oracle
    System.Data.OracleClient
    System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Microsoft SQL Server Compact Data Provider
    .NET Framework Data Provider for Microsoft SQL Server Compact
    System.Data.SqlServerCe.3.5
    System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
    SQLite Data Provider
    .Net Framework Data Provider for SQLite
    System.Data.SQLite
    System.Data.SQLite.SQLiteFactory, System.Data.SQLite
    SqlClient Data Provider
    .Net Framework Data Provider for SqlServer
    System.Data.SqlClient
    System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    So SQLite is in there!!

  • 07-27-2009 8:43 AM In reply to

    Re: Am I going insane?

    ... I hate to even ask this, but ... you did deploy System.Data.SQLite.dll to your bin directory with the rest of your binaries, right?

  • 07-28-2009 4:52 AM In reply to

    • JasonM
    • Not Ranked
    • Joined on 07-24-2009
    • Posts 4

    Re: Am I going insane?

    Yes.  I had deployed the DLL to my bin folder.  I've figured it out now.  Don't know if this was in the help file or not as I couldn't read the help file, but it seems I was calling the "name" of the provider rather than the "invarient".  My web config contained this:-

     <DbProviderFactories>
      <
    remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider"
        invariant="System.Data.SQLite"
        description=".Net Framework Data Provider for SQLite"
        type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
    </
    DbProviderFactories>

    and the code I was using was this:

     DbProviderFactory provider = DbProviderFactories.GetFactory("SQLite Data Provider");

    but I should have been doing this:

    DbProviderFactory provider = DbProviderFactories.GetFactory(System.Data.SQLite);

    Works fine now.  The only thing confusing me is why the help file wasn't working on 2 different machines.  But hey, thanks for the help anyway.  Cheers.

  • 07-29-2009 5:31 AM In reply to

    • Knch
    • Top 50 Contributor
    • Joined on 02-10-2009
    • Posts 30

    Re: Am I going insane?

    For your CHM issue you might want to read http://blog.crowe.co.nz/archive/2007/04/13/719.aspx
Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems