system.data.sqlite

With Wix, distribute a program that uses SQLite (must work on both 32bit and 64bit)

落爺英雄遲暮 提交于 2019-12-08 15:09:27
问题 With WiX, I want to distribute a C# program that uses SQLite. SQLite recommends the files structure below, so I use it: In Wix, I create the x86 and x64 folders and put the right DLL in each: <Directory Id='x86' Name='x86'> <Component Id='x86' Guid='...'> <CreateFolder /> <File Id='f86' Name='SQLite.Interop.dll' Source='x86\SQLite.Interop.dll' /> </Component> </Directory> <Directory Id='x64' Name='x64'> <Component Id='x64' Guid='...'> <CreateFolder /> <File Id='f64' Name='SQLite.Interop.dll'

System.Data.SQLite Not Supporting Multiple Transactions

怎甘沉沦 提交于 2019-12-08 14:53:55
问题 So I am having an interesting issue with System.Data.SQLite and using multiple transactions. Basically I have the following code which fails: using (IDbConnection connection1 = new SQLiteConnection("connectionstring"), connection2 = new SQLiteConnection("connectionstring")) { connection1.Open(); connection2.Open(); IDbTransaction transaction1 = connection1.BeginTransaction(); IDbTransaction transaction2 = connection2.BeginTransaction(); // Fails! using(IDbCommand command = new SQLiteCommand()

DataGridView does not display DataTable

狂风中的少年 提交于 2019-12-08 12:06:14
问题 I've got the following code which I think ought to be binding a DataTable to a DataGridView, but the DataGridView shows up empty. The DataTable definately has rows, so I assume that I am binding the DataSource incorrectly some how. Does anyone see what is wrong with this: DataBase db = new DataBase(re.OutputDir+"\\Matches.db"); MatchDBReader reader = new MatchDBReader(db.NewConnection()); BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = reader.GetDataTable(); this

Error retrieving BLOB field using System.Data.SQLite.SQLIteDataReader.GetBlob

旧时模样 提交于 2019-12-08 09:34:23
问题 Due to reasons beyond my control, I am creating a .NET 2.0 assembly in which I load a SQLite database and retrieve some binary data from it. Specifically, PDF documents. The documentation for System.Data.SQLite.SQLiteDataReader.GetBlob(int i, bool ReadOnly) says: (emphasis mine) Retrieves the column as a System.Data.SQLite.SQLiteBlob object. This will not work for tables that were created WITHOUT ROWID -OR- if the query does not include the "rowid" column or one of its aliases -OR- if the

Creating database using DataContext and System.Data.SQLite in C#

最后都变了- 提交于 2019-12-07 17:46:57
问题 I'm writing simple application gathering information about machine's hardware. I plan to store data in sqlite. Got following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SQLite; using System.IO; using System.Data; using System.Data.Linq; using System.Data.Linq.Mapping; namespace SQLiteTest { public class MyDB : DataContext { public Table<Computer> kompy; public MyDB(string connection) : base(connection) { } public MyDB

Open .sqlite file with C#

有些话、适合烂在心里 提交于 2019-12-07 11:43:35
问题 Hi i have a file called test.sqlite. How do i go about reading all contents from this file to the console? I already have System.Data.Sqlite static void Main(string[] args) { SQLiteConnection _SQL = new SQLiteConnection("Data Source=C:\\test.sqlite"); _SQL.Open(); SQLiteCommand cmd = new SQLiteCommand(); } 回答1: To use SQLite in your C# application, you need to download a third party free ADO.NET data provider SQLite.NET.0.21_x68_dll. You can download it from here: Sql Lite Driver for C# and

Include x32 or x64 System.Data.SQLite.dll file correctly

南笙酒味 提交于 2019-12-07 09:35:42
问题 I was searching on internet about it but I'm not sure exactly what to do. I found out that I need to include some code in my Program.csproj file. When I open Program.csproj it says <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectView>ShowAllFiles</ProjectView> </PropertyGroup> </Project> this is code which I need to include: <Reference Include="System, Version=1.0.66.0, Culture=neutral, processorArchitecture=MSIL" Condition=" '$(Platform)' ==

INSERT with transaction and parameters?

一笑奈何 提交于 2019-12-07 07:28:51
问题 I'm learning about VB.Net and need to work with an SQLite database using the open-source System.Data.SQLite ADO.Net solution The examples I found in the HOWTO section are only in C#. Would someone have a simple example in VB.Net that I could study to understand how to use transactions when INSERTing multiple parameters? FWIW, here's the code I'm working on: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SQLconnect As New SQLite

How to enable foreign key cascade delete by default in SQLite?

橙三吉。 提交于 2019-12-07 01:46:52
问题 SQLite v3.7.5 Is there a way to enable SQLite Foreign Keys with cascade delete enabled by default? Given the following example: CREATE TABLE [Parent] ( [ParentId] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, [Name] VARCHAR(50) UNIQUE NOT NULL ); CREATE TABLE [Child] ( [ChildId] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [ParentId] INTEGER NOT NULL, [Name] VARCHAR(50) NOT NULL, FOREIGN KEY(ChildId) REFERENCES Child(ParentId) ON DELETE CASCADE ); The only way I've been able to enable the

LINQ-to-SQL with SQLite: syntax error near “SELECT” when inserting

被刻印的时光 ゝ 提交于 2019-12-06 15:54:14
I have been using the System.Data.SQLite provider for my application. When I try to create a new object and insert it into the database, however, I get a SQL syntax error near "SELECT" . Basically my code looks like: //supplies is a DataContext connected to my DB Table<Store> stores = supplies.Stores; //... Store newStore = new Store(); // A Store has an Id (pk autoincrement), Name, Number, and EntitySet<Usages> newStore.Name = "New Store"; newStore.Number = 0; //... stores.InsertOnSubmit(newStore); supplies.SubmitChanges(); but spread throughout some methods. Is this a common/newbie problem?