mysql helper c_.NET 使用 MySql.Data.dll 动态库操作MySql的相助类-MySqlHelper_mysql

  • Post author:
  • Post category:mysql


.NET 使用 mysql.Data.dll 动态库操作MySql的帮助类–MySqlHelper

.NET 使用 MySql.Data.dll 动态库操作MySql的帮助类–MySqlHelper

参考示例代码,如下所示:

/// /// MySql 数据库操作类 /// public class MySqlHelper { #region MysqlConnection private static MySql.Data.MySqlClient.MySqlConnection _mysqlConnection; /// /// MySqlConnection 连接信息 /// public static MySql.Data.MySqlClient.MySqlConnection MysqlConnection { get { String mysqlConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[“Libor_MySql_QuoteCenter_ConnectionString”].ToString(); if (_mysqlConnection == null) _mysqlConnection = new MySql.Data.MySqlClient.MySqlConnection(mysqlConnectionString); if (_mysqlConnection.State == System.Data.ConnectionState.Closed) _mysqlConnection.Open(); if (_mysqlConnection.State == System.Data.ConnectionState.Broken) { _mysqlConnection.Close(); _mysqlConnection.Open(); } return MySqlHelper._mysqlConnection;



版权声明:本文为weixin_42160252原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。