我正在尝试学习如何将 SQLite 与 c# (mono/monodevelop) 一起使用。我在我的解决方案中包含了 SQLite 参考,我正在尝试编译这个简单的代码:
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();
}
}
}
但我得到这个错误:
The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced
我该如何解决这个问题?
我是 C# 的新手,我希望有人能指出我正确的方向。