Commit 7a1e410e by lizefeng

优化connection 在并发情况下会出现异常

parent f10b3ee9
......@@ -8,16 +8,17 @@ namespace AutoTurnOver.DB
{
public class connectionHelper
{
private static MySqlConnection connection = new MySqlConnection("server=gz-cdb-hqmznu0w.sql.tencentcdb.com;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;port=63523;Convert Zero Datetime=True;Allow User Variables=True");
//private static MySqlConnection connection = new MySqlConnection("server=gz-cdb-hqmznu0w.sql.tencentcdb.com;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;port=63523;Convert Zero Datetime=True;Allow User Variables=True");
public static MySqlConnection _connection
{
get {
if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
return connection;
//if (connection.State == System.Data.ConnectionState.Closed)
//{
// connection.Open();
//}
//return connection;
return new MySqlConnection("server=gz-cdb-hqmznu0w.sql.tencentcdb.com;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;port=63523;Convert Zero Datetime=True;Allow User Variables=True");
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment