对于我的VB.Net项目,我试图添加对SQLite数据库的支持。我已经通过NuGet和VS 2010安装了System.Data.SQLite.dll。
我可以成功连接到SQLite数据库并直接针对它运行一些查询。但是,我无法将任何数据加载到我的DataSourcesTableAdapters中。我得到一个“'System.Data.SQLite'提供程序未在本地计算机上注册。”我试图填写数据表时出错。
使用原始MS Access数据文件时,一切正常。
目标CPU是x86
System.Data.SQLite.dll被复制到本地app文件夹
Stack Trace:
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(constr As OleDbConnectionString, datasrcWrapper As DataSourceWrapper&)
at System.Data.OleDb.OleDbConnectionInternal..ctor(constr As OleDbConnectionString, connection As OleDbConnection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(options As DbConnectionOptions, poolGroupProviderInfo As Object, pool As DbConnectionPool, owningObject As DbConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(owningConnection As DbConnection, poolGroup As DbConnectionPoolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(owningConnection As DbConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(outerConnection As DbConnection, connectionFactory As DbConnectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(connection As IDbConnection, originalState As ConnectionState&)
at System.Data.Common.DbDataAdapter.FillInternal(dataset As DataSet, datatables As DataTable[], startRecord As Int32, maxRecords As Int32, srcTable As String, command As IDbCommand, behavior As CommandBehavior)
at System.Data.Common.DbDataAdapter.Fill(dataTables As DataTable[], startRecord As Int32, maxRecords As Int32, command As IDbCommand, behavior As CommandBehavior)
at System.Data.Common.DbDataAdapter.Fill(dataTable As DataTable)
at LisanoEnterprises.GrandPrix.DataSourcesTableAdapters.RostersTableAdapter.GetDataByRound(Round As Int32)
at LisanoEnterprises.GrandPrix.ReportCtrl.ViewRosters(objReportCriteria As ReportCriteria)
at LisanoEnterprises.GrandPrix.frmReports.ViewRoster()
at LisanoEnterprises.GrandPrix.frmReports.ViewReport(iCategory As Int32, iReportNum As Int32)
at LisanoEnterprises.GrandPrix.frmReports.btnMainView_Click(sender As Object, e As EventArgs)
Exception Hierarchy:
Top Level System.InvalidOperationException Void GetDataSource(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.DataSourceWrapper ByRef)
The 'System.Data.SQLite' provider is not registered on the local machine.
答案 0 :(得分:0)
我设法解决了这个问题。我没有使用表适配器,而是从数据读取器加载数据表。
Dim reader As IDataReader = _dbCtrl.ExecuteReader(sSQL)
Dim dt As New DataTable
dt.Load(reader)
reader.Close()