【问题标题】:Reference to type 'Component' claims it is defined in 'System', but it could not be found对“组件”类型的引用声称它在“系统”中定义,但找不到
【发布时间】:2017-06-29 20:41:17
【问题描述】:

我正在尝试在作为 Xamarin Forms 应用程序一部分的 UWP 项目中使用 SqlConnection 类。我需要对我添加的 System.Data.DLL 的引用。但是,当我尝试像这样创建 SqlConnection 时:

using (SqlConnection connection = new SqlConnection(queryString))
{

};

我收到错误 Reference to type 'Component' claims it is defined in 'System', but it could not be found.

我可以像这样声明一个 SqlConnection 变量:

SqlConnection con = new SqlConnection();

我只有在尝试使用该对象时才会收到错误消息。比如在using 语句中。

我不确定我做错了什么。网站上的其他类似问题似乎对我的情况没有帮助。

【问题讨论】:

    标签: c# xamarin uwp xamarin.forms


    【解决方案1】:

    关于微软的代码源说:

    该示例演示了如何访问 SQL Server 数据库中的数据 Windows 应用商店应用程序。我们无法从 Windows 访问 SQL Server 数据库 直接存储应用程序。我们必须创建一个服务层来访问 数据库。

    https://code.msdn.microsoft.com/How-to-access-data-from-5f2602ec#content

    【讨论】:

      猜你喜欢
      • 2017-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-23
      • 2018-09-12
      • 2018-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多