提交当前本机整理版本
This commit is contained in:
@@ -421,4 +421,35 @@ namespace Lskj.Core
|
||||
SqlHelper.ConnectionType = ConnectionType.DmServer;
|
||||
}
|
||||
SqlHelper.dbFactory = DbProviderFactories.GetFactory(providerName);
|
||||
|
||||
if (SqlHelper._connection != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlHelper._connection.Close();
|
||||
SqlHelper._connection.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
SqlHelper._connection = null;
|
||||
}
|
||||
try
|
||||
{
|
||||
SqlHelper._connection = SqlHelper.dbFactory.CreateConnection();
|
||||
SqlHelper._connection.ConnectionString = connStr;
|
||||
SqlHelper._connection.Open();
|
||||
isConnect = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteLog(ex.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
return isConnect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user