system.data.sqlite

C# Failed to find or load the registered .Net Data Provider error

冷暖自知 提交于 2019-11-28 02:04:50
问题 I am using SQLite and the wrapper from http://sqlite.phxsoftware.com/ and when I add a data source to my project I get the error: "Some updating commands could not be generated automatically, the database returned to the following error: Failed to find or load the registered .Net Framework data provider" I have the latest .Net service pack and I have uninstalled and reinstalled the SQLite software. I have also looked other places which suggest this entry is not in the machine.config file:

Mono on Mac: DllNotFoundException despite SQLite.Interop.dll being in dllmap

随声附和 提交于 2019-11-28 01:35:00
问题 I have a C# application that uses SQLite and works fine on Windows. The same Visual Studio project compiles fine in Xamarin Studio, but when running I get: DllNotFoundException: SQLite.Interop.dll Despite: libsqlite3.0.dylib is in /usr/lib and also in the same folder as the executable and other DLLs . is part of the $DYLD_LIBRARY_PATH The executable and all SQLite-using DLLs have a matching <the_exe_or_dll_including_filename_extension>.config file containing: <configuration> <dllmap dll=

What is the difference between connection.Close() and connection.Dispose()? [duplicate]

[亡魂溺海] 提交于 2019-11-28 00:18:45
问题 This question already has an answer here: Close and Dispose - which to call? 7 answers I noticed that the SQLiteConnection object in System.Data.SQLite owns two similar methods : Close() Dispose() Same for the SQLiteDataReader object. What is the difference ? 回答1: Dispose also closes the connection if it hasn't been closed, but when calling Close , you can reopen the connection again. This is not possible when the connection is disposed. In general, don't call Close , but simply call dispose

Visual Studio loading the right (x86 or x64) dll!

﹥>﹥吖頭↗ 提交于 2019-11-27 12:15:57
问题 I'm working on visual studio in an x86. I would like to build my application for both x32 and x64. But i need to use the sqlite .net connector wich has a dll for x86 apps and another dll for x64 apps. How do i configure my visual studio to load a reference when my configuration is x64 and another when my configuration is x86? Thanks, Richard. 回答1: in your project file in reference use an MSBUILD conditional <Reference Include="SomeAssembly86, Version=0.85.5.452, Culture=neutral,

Retrieving error codes from SQLite when using ExecuteNonQuery()

爱⌒轻易说出口 提交于 2019-11-27 07:32:18
问题 In my C# project, I'm using System.Data.SQLite.dll downloaded from CodeProject. My problem is as per the title - how to get the error codes after calling SqliteCommand.ExecuteNonQuery() function? Error codes such as SQLITE_CONSTRAINT, SQLITE_BUSY, SQLITE_LOCKED as shown here. 回答1: use the Exception.StackTrace or the SQLiteException.ErrorCode try { } catch(SQLiteException ex) { string code = ex.ErrorCode; } 回答2: I'm going to add to this to help others, if you're developing in .NET. Use the

SQLite keeps the database locked even after the connection is closed

限于喜欢 提交于 2019-11-27 03:49:47
I'm using System.Data.SQLite provider in an ASP.NET application (framework 4.0). The issue I'm running into is that when I INSERT something in a table in the SQLite database, the database gets locked and the lock isn't being released even after the connection is disposed. When trying to access the file, the error is: "The process cannot access the file 'catalog.sqlite' because it is being used by another process." My code is pretty straightforward, I open the connection, read some data from a SQLServer database, insert that data into SQLite (through SQLiteDataAdapter) and then close the

Entity Framework 6 with SQLite 3 Code First - Won't create tables

痴心易碎 提交于 2019-11-26 18:39:15
Using latest versions of EF6 and SQLite from NuGet. I finally got the app.config file to work after some useful posts on Stackoverflow. Now the problem is that the tables are not being created although the database is. My app.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken

Adding parameters in SQLite with C#

白昼怎懂夜的黑 提交于 2019-11-26 17:45:31
Im just learning SQLite and I can't get my parameters to compile into the command properly. When I execute the following code: this.command.CommandText = "INSERT INTO [StringData] VALUE (?,?)"; this.data = new SQLiteParameter(); this.byteIndex = new SQLiteParameter(); this.command.Parameters.Add(this.data); this.command.Parameters.Add(this.byteIndex); this.data.Value = data.Data; this.byteIndex.Value = data.ByteIndex; this.command.ExecuteNonQuery(); I get a SQLite Exception. Upon inspecting the CommandText I discover that whatever I'm doing is not correctly adding the parameters: INSERT INTO

SQLite Database Locked exception

故事扮演 提交于 2019-11-26 15:23:54
I am getting Database is locked exception from SQLite for some queries only. Below is my code: When I execute any select statement it works fine. When I am executing any write statement on Jobs Table it also works fine. This works fine: ExecuteNonQuery("DELETE FROM Jobs WHERE id=1"); But the same way if I am executing queries for Employees table it is throwing an exception that database is locked . This throws Exception: ExecuteNonQuery("DELETE FROM Employees WHERE id=1"); Below are my functions: public bool OpenConnection() { if (Con == null) { Con = new SQLiteConnection(ConnectionString); }

SQLite Insert very slow?

丶灬走出姿态 提交于 2019-11-26 14:30:29
I recently read about SQLite and thought I would give it a try. When I insert one record it performs okay. But when I insert one hundred it takes five seconds, and as the record count increases so does the time. What could be wrong? I am using the SQLite Wrapper (system.data.SQlite) : dbcon = new SQLiteConnection(connectionString); dbcon.Open(); //---INSIDE LOOP SQLiteCommand sqlComm = new SQLiteCommand(sqlQuery, dbcon); nRowUpdatedCount = sqlComm.ExecuteNonQuery(); //---END LOOP dbcon.close(); Wrap BEGIN \ END statements around your bulk inserts. Sqlite is optimized for transactions. dbcon =