我收到这个错误
错误 CS0012:类型“DbConnection”是在未引用的程序集中定义的。您必须添加对程序集“System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”的引用。 (CS0012)
我正在尝试这样做:
private void SetConnection()
{
sql_con = new SQLiteConnection("DataSource=kyriosDB.db;Version=3;New=False;Compress=True;");
}
public void ExecuteQuery(string txtQuery)
{
SetConnection();
sql_con.Open();
sql_cmd = sql_con.CreateCommand();
sql_cmd.CommandText = txtQuery;
sql_cmd.ExecuteNonQuery();
sql_con.Close();
}
有人可以帮助我吗?
最佳答案
我通过转到项目 - 添加引用解决了这个问题,然后我在 Mac 上手动添加 System.Data...我不了解 VS windows,但希望它是相同的
关于c# - 错误 CS0012 : The type 'DbConnection' is defined in an assembly that is not referenced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47651251/