AndroidApp和MySqlConnection无法正常工作connection.open [英] AndroidApp and MySqlConnection didn't work connection.open

查看:82
本文介绍了AndroidApp和MySqlConnection无法正常工作connection.open的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开连接时发生错误,并说:

When I try to open the connection an error occurred and say:

System.TypeInitializationException:"MySql.Data.MySqlClient.Replication.ReplicationManager"的类型初始值设定项引发了异常.

System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.

这是代码的一部分:

MySqlConnection _Conn;

public void Conectar()
{
    new I18N.West.CP1250();

    string SC;

    SC = "server = XXX; Port = 3306; database = XXX; user id = XXX; password = XXX; charset = utf8";

    _Conn = new MySqlConnection(SC);

    _Conn.Open();
}

推荐答案

如果Xamarin出现问题,您应该这样做:

If you problem ocorred with Xamarin, you should do:

1)删除参考MySQL数据

1) Remove Reference Mysql Data

2)添加参考Xamarin.Mysql

2) Add Reference Xamarin.Mysql

您可以保留您的通话(使用MySql.Data.MySqlClient;)

You can keep yours calls (using MySql.Data.MySqlClient;)

这篇关于AndroidApp和MySqlConnection无法正常工作connection.open的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆