简体   繁体   English

错误CS0012:类型“DbConnection”在未引用的程序集中定义

[英]Error CS0012: The type 'DbConnection' is defined in an assembly that is not referenced

I got this error 我收到了这个错误

Error CS0012: The type 'DbConnection' is defined in an assembly that is not referenced. 错误CS0012:类型“DbConnection”在未引用的程序集中定义。 You must add a reference to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 您必须添加对程序集'System.Data,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的引用。 (CS0012) (CS0012)

I'm trying to do this: 我正在尝试这样做:

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();
} 

Someone can help me? 有人可以帮帮我吗?

我通过去项目解决了它 - 添加引用然后我在Mac上手动添加System.Data ...我不知道VS windows但是希望它是一样的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误CS0012:类型'TaskAwaiter <>'在未引用的程序集中定义 - error CS0012: The type 'TaskAwaiter<>' is defined in an assembly that is not referenced CS0012 类型“EventLogEntryType”在未引用的程序集中定义 - CS0012 The type 'EventLogEntryType' is defined in an assembly that is not referenced CS0012 C#类型“ HttpContext”在未引用的程序集中定义 - CS0012 C# The type 'HttpContext' is defined in an assembly that is not referenced 错误CS0012:类型&#39;ConnectionStringSettings&#39;在升级到Visual Studio 2015后未引用的程序集中定义 - error CS0012: The type 'ConnectionStringSettings' is defined in an assembly that is not referenced after upgrading to Visual Studio 2015 使用RazorTemplates库时发生错误:&#39;CS0012:类型&#39;System.Attribute&#39;在未引用的程序集中定义&#39; - Error when using RazorTemplates library: 'CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced' .Net Core-CS0012&#39;对象&#39;在未引用的程序集中定义 - .Net Core - CS0012 'Object' is defined in an assembly that is not referenced CS0012 System.enum在未针对.NET 4.5的构建服务器上引用的程序集中定义 - CS0012 System.enum is defined in an assembly not referenced on build server targeting .NET 4.5 MSBuild错误CS0012 - MSBuild Error CS0012 FluentAssertions 错误 CS0012:您必须添加对程序集 System.Data 的引用 - FluentAssertions error CS0012: You must add a reference to assembly System.Data 带有显式调用的 C# 构造函数歧义 - 错误 CS0012 - C# Constructors Ambiguity with explicit call - Error CS0012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM