Sqlite in mono, SQLiteConnection could not be found

I'm not sure how to fix this error.

The type or namespace name `SQLiteConnection' could not be found. Are you missing a using directive or an assembly reference?

      

I've included the Mono.Data Mono.Data.Sqlite Mono.Data.SqliteClient link and a few unrelated links. I use

//using System.Data.SQLite; //<-- this line was all i needed in msvs
using Mono.Data.Sqlite;
using Mono.Data.SqliteClient;
using System;
using System.Data;
using Mono.Data.SqliteClient

      

0


source to share


3 answers



Have you included the links (dll) from http://sqlite.phxsoftware.com/ ?
If not, try doing this and it should work.



EDITOR: The above if you want to use System.Data.SQLite, but you can also use the built-in Mono.Data.SqliteClient, which might be better if you are using Mono. Read more about this here http://www.mono-project.com/SQLite . They are using SqliteConnection in their sample code and you seem to be using SQLiteConnection, please note another case.

+1


source


Make sure you reference the DLL when compiling:



gmcs -r: Mono.Data.SqliteClient.dll myapp.cs

0


source


I got the same error, and part of it is that method names have different cases on Windows and Mono:

Windows: SQLiteConnection
Mono:    SqliteConnection

      

It works for me with the help ofusing this code in the files it needs:

#if __MonoCS__
    using Mono.Data.Sqlite;
    using SQLiteCommand =     Mono.Data.Sqlite.SqliteCommand;
    using SQLiteConnection =  Mono.Data.Sqlite.SqliteConnection;
    using SQLiteException =   Mono.Data.Sqlite.SqliteException;
    using SQLiteParameter =   Mono.Data.Sqlite.SqliteParameter;
    using SQLiteTransaction = Mono.Data.Sqlite.SqliteTransaction;
#else
    using System.Data.SQLite;
#endif

      

Jim

0


source







All Articles