db
是我的 MySqlConnection。当我尝试运行:db.Open();
时,我收到此错误:
The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”.
所以我按照它添加了 System.Data
引用。现在我收到此错误:
Reference to type 'Component' claims it is defined in System but it could not be found
我正在使用 .NET Framework v4.0、MySQL Connector v6.9.9、Xamarin Forms v2.3.2.127 和所有 Android 支持 v23.4.0.1
附注我读过一些有关 PCL 的内容,但我不知道我使用的包是否是 PCL。
最佳答案
请在连接字符串中指定数据库名称
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;
Pwd=myPassword
关于c# - Xamarin无法连接到mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39789051/