Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Database and Reporting (http://www.xtremevbtalk.com/-net-database-and-reporting/)
-   -   ReportViewer with SQLite Problem (http://www.xtremevbtalk.com/-net-database-and-reporting/327728-reportviewer-sqlite.html)

gpraceman 08-10-2015 07:23 PM

Problem filling DataTable from SQLite database
 
I have a desktop app using WinForms and am adding support for SQLite data files to it. I can connect to the data file and pull up data in the forms no problem, but I run into a "The 'System.Data.SQLite' provider is not registered on the local machine." error when trying to pull up a report with ReportViewer 2010.

I've done a bit of searching around and have added the following entry to my app.config file, but still get the error.

Code:

    <system.data>
      <DbProviderFactories>
        <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
            type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.97.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
      </DbProviderFactories>
    </system.data>

The System.Data.SQLite.dll file is copied to the local app folder.

PlausiblyDamp 08-11-2015 05:59 AM

Not tried this and have no idea if it works but have you tried installing the .dll into the GAC?

gpraceman 08-11-2015 09:28 AM

In the docs for SQLite it says "Installing the assemblies into the Global Assembly Cache is not recommended as it may cause conflicts with other applications installed on the machine."

PlausiblyDamp 08-11-2015 12:00 PM

Fair enough :D

You might want to try changing the type attribute to
Code:

type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
Removing the public key, language and version parts of the name will eliminate any potential discrepancies.

gpraceman 08-11-2015 12:14 PM

Quote:

Originally Posted by PlausiblyDamp (Post 1408703)
Fair enough :D

You might want to try changing the type attribute to
Code:

type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
Removing the public key, language and version parts of the name will eliminate any potential discrepancies.

No joy unfortunately.

Doing some more digging, it really isn't an issue with the ReportViewer. The error occurs when it tries to fill the DataTable which is sent to the report.

Below is some sample code. The error occurs when getting the data from the table adapter.

Code:

      Dim dtaTurnaroundStats As New DataSourcesTableAdapters.TurnaroundStatsTableAdapter
      Dim dt As DataSources.TurnaroundStatsDataTable

      dtaTurnaroundStats.Connection.ConnectionString = g_objDBCtrl.ConnectionString

      If objCriteria.Group.ID > 0 Then
        dt = dtaTurnaroundStats.GetDataByGroup(objCriteria.Group.Name)
      ElseIf objCriteria.Round.Number > 0 Then
        dt = dtaTurnaroundStats.GetDataByRound(objCriteria.Round.Number)
      Else
        dt = dtaTurnaroundStats.GetData
      End If


gpraceman 08-11-2015 02:01 PM

I've managed to work around the issue. Instead of using the table adapters, I am loading a data table from a data reader.

Code:

      Dim objReader As IDataReader = g_objDBCtrl.ExecuteReader(sSQL)
      Dim dt As New DataTable

      dt.Load(objReader)

      objReader.Close()



All times are GMT -6. The time now is 06:14 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.