I’m trying to learn how to use SQLite with c# (mono/monodevelop).
I’ve included the SQLite reference in my Solution, and I’m trying to compile this simple code:
using System;
using System.Data;
using System.Data.SQLite;
namespace SqliteTest
{
class SqliteTest
{
static void dbstuff ()
{
//Creating DB
SQLiteConnection.CreateFile("MyDatabase.sqlite");
//Creating a Connection
SQLiteConnection m_dbConnection;
m_dbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
//Conntecting
m_dbConnection.Open();
//Run some sql commands
string sql = "CREATE TABLE highscores (name VARCHAR(20), score INT)";
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery(); //This command just indicae the number of rows that have been modified
}
static void Main()
{
dbstuff();
}
}
}
But I get this error:
The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced
How can I solve this ?
I’m a newbie with C#, I hope that somebody can point me to the right direction.
add
in front of the file.