0

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 the reference Mono.Data Mono.Data.Sqlite Mono.Data.SqliteClient and a few non related refs. I am using

//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
Mr Lister
  • 45,515
  • 15
  • 108
  • 150

3 Answers3

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.

fredrik
  • 13,282
  • 4
  • 35
  • 52
0

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: SQLiteConnection
Mono:    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;
#else
    using System.Data.SQLite;
#endif

Jim

Community
  • 1
  • 1
JimH44
  • 504
  • 5
  • 13
0

Make sure you are referencing the DLL when compiling:

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

jpobst
  • 9,982
  • 1
  • 29
  • 33