system.data.sqlite

c#/.NET SQLite -- REINDEX not working?

Hello all, I'm trying to reindex a table in a simple database that I created using SQLite.NET and VS2008. I need to reindex tables after every DELETE command and here is the code snippet I have written (it does not work): SQLiteCommand currentCommand; String tempString = "REINDEX tf_questions"; //String tempString = "REINDEX [main].tf_...

Date calculations with sqlite3

I'm trying to calculate TimeSpans between dates. I have no problem with this if the date is formatted using the native sqlite3 format 'YYYY-dd-mm' How would I do this if the date is formatted differently, such as 'dd-mm-YYYY' I've tried the following with no success. --Select days between two days; this works if the datetime string i...

SQLite.Net Issue With BeginTransaction

I'm trying to use System.Data.Sqlite library, and I'm following the documentation about optimizing inserts so I copied this code directly out of the documentation: using (SQLiteTransaction mytransaction = myconnection.BeginTransaction()) { using (SQLiteCommand mycommand = new SQLiteCommand(myconnection)) { SQLiteParame...

What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

I have a project in which I'd like to use some of the .NET 4.0 features but a core requirement is that I can use the System.Data.SQLite framework which is compiled against 2.X. I see mention of this being possible such as the accepted answer here but I don't see how to actually achieve this. When I just try and run my 4.0 project while ...

List Attached Databases using a SELECT command in SQLite

Is there a SELECT command that can list all attached databases similar to the .database command available in sqlite3? ...

Exception using SQLiteDataReader

I'm making a Custom SQLite Wrapper. This is meant to allow a presistent connection to a database. However, I receive an exception when calling this function twice. public Boolean DatabaseConnected(string databasePath) { bool exists = false; if (ConnectionOpen()) { this.Command.CommandText = string.Format(DATABASE_Q...

Issues related to SQLLite Index

Hi All: We are using SQLite database to store data. We are having a very peculiar situation. Let me summarize Database having multiple tables. Tables having 3000 rows. Tables are having index. There is considerable gain due to indexes. When I run the application and access certain data the query runs slow. But if I just open the datab...

IIS 7.5 refuses to load 64-bit assembly - possible CAS problem?

Hi, I just downloaded the Orchard CMS, opened it up in VS2008 and hit F5: Everything runs fine. I then created a website in IIS 7.5 and pointed it to the web project's directory and set up permissions correctly (I hope). I downloaded the 64-bit version System.Data.SQLite as suggested here: Orchard Work Item 14798 and here: SO: Could n...

Updating multiple related tables in SQLite

Just some background, sorry so long winded. I'm using the System.Data.SQLite ADO.net adapter to create a local sqlite database and this will be the only process hitting the database, so I don't need to worry about concurrency. I'm building the database from various sources and don't want to build this all in memory using datasets or da...

SQLiteException and SQLite error near "(": syntax error with Subsonic ActiveRecord

I ran into an interesting error with the following LiNQ query using LiNQPad and when using Subsonic 3.0.x w/ActiveRecord within my project and wanted to share the error and resolution for anyone else who runs into it. The linq statement below is meant to group entries in the tblSystemsValues collection into their appropriate system and ...

System.Data.SQLite parameterized queries with multiple values?

I am trying to do run a bulk deletion using parameterized queries. Currently, I have the following code: pendingDeletions = new SQLiteCommand(@"DELETE FROM [centres] WHERE [name] = $name", conn); foreach (string name in selected) pendingDeletions.Parameters.AddWithValue("$name", name); pendingDeletions.ExecuteNonQuery(); However...

Does SQLite support transactions across multiple databases?

I've done some searching and also read the FAQ on the SQLite site, no luck finding an answer to my question. It could very well be that my database approach is flawed, but at the moment, I would like to store my data in multiple SQLite3 databases, so that means separate files. I am very worried about data corruption due to my applicati...

Receiving DB update events in .NET from SQLite

I've recently discovered the awesomeness of SQLite, specifically the .NET wrapper for SQLite at http://sqlite.phxsoftware.com/. Now, suppose I'm developing software that will be running on multiple machines on the same network. Nothing crazy, probably only 5 or 6 machines. And each of these instances of the software will be accessing an...

SQLite assembly not copied to output folder for unit testing

Problem: SQLite assembly referenced in my DAL assembly does not get copied to the output folder when doing unit tests (Copy local is set to true). I am working on a .Net 3.5 app in VS2008, with NHibernate & SQLite in my DAL. Data access is exposed through the IRepository interface (repository factory) to other layers, so there is no nee...

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

Hi, 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...

ObjectContext ConnectionString Sqlite

I need to connect to a database in Sqlite so i downloaded and installed System.Data.SQLite and with the designer dragged all my tables. The designer created a .cs file with public class Entities : ObjectContext and 3 constructors: 1st public Entities() : base("name=Entities", "Entities") this one load the connection string from A...

Bind SQLiteDataReader to GridView in ASP.NET

Hi, dr looks like it is populated but I get a nullreferenceexeception when I try to bind to the gridview EDIT The following code (except the GridView is a dataGridView) in a c# application works, why is it nullreference in ASP.NET? EDIT here is the c# app SQLiteConnection cnn = new SQLiteConnection("Data Source=c:\\log.db"); ...

How to use System.Data.SQLite under mono?

I downloaded System.Data.SQLite, and tried to compile the following sample code. using System; using System.Data; using System.Data.Common; using System.Data.SQLite; namespace test { class Program { static void Main(string[] args) { SQLiteConnection.CreateFile("/Users/smcho/Desktop/SQLite-1/example/mydatabasefile.db...

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

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();...

Android sqlight problem always null

every time i am using the db its null and i just dont get it i use this code for the SQL when I have quarry : public class GameSQLHelper { static final String[] COUNTRIES = new String[] { "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra" }; private static final String DB_PATH = "/countryCityG...