Skip to content Skip to sidebar Skip to footer

Sqlite In Mono, Sqliteconnection Could Not Be Found

I am not sure how to correct this error. The type or namespace name `SQLiteConnection' could not be found. Are you missing a using directive or an assembly reference? I included t

Solution 1:

Have you included the references (dll) from http://sqlite.phxsoftware.com/ ? If not, try to do that, and it should work.

EDIT: The above is if you want to use System.Data.SQLite, but you can also use the built in Mono.Data.SqliteClient that might be better if you use Mono. Read more about it here http://www.mono-project.com/SQLite. In their code example they use SqliteConnection, and you seems to use SQLiteConnection, notice the different case.

Solution 2:

Make sure you are referencing the DLL when compiling:

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

Solution 3:

I got the same kind of error, and part of it is that the method-names have different case in Windows and in Mono:

Windows: SQLiteConnectionMono:    SqliteConnection

I got it working with with help from here, using this code in files that needed it:

#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;
#elseusing System.Data.SQLite;
#endif

Jim

Post a Comment for "Sqlite In Mono, Sqliteconnection Could Not Be Found"