SVN r1061
SVN-Revision: r1061
This commit is contained in:
+22
-31
@@ -20,6 +20,7 @@ using System.Net.Sockets;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Data.Common;
|
||||||
|
|
||||||
namespace Lskj.Core
|
namespace Lskj.Core
|
||||||
{
|
{
|
||||||
@@ -178,7 +179,7 @@ namespace Lskj.Core
|
|||||||
DataBase = subKey.GetValue("datastr", "") + "";
|
DataBase = subKey.GetValue("datastr", "") + "";
|
||||||
ServerName = subKey.GetValue("ServerName", "") + "";
|
ServerName = subKey.GetValue("ServerName", "") + "";
|
||||||
InternalNetworkAddress = subKey.GetValue("InternalNetworkAddress", "") + "";
|
InternalNetworkAddress = subKey.GetValue("InternalNetworkAddress", "") + "";
|
||||||
ExternalNetworkAddress= subKey.GetValue("ExternalNetworkAddress", "") + "";
|
ExternalNetworkAddress = subKey.GetValue("ExternalNetworkAddress", "") + "";
|
||||||
|
|
||||||
IsInternalNetwork = (subKey.GetValue("IsInternalNetwork", "") + "").Equals("1");
|
IsInternalNetwork = (subKey.GetValue("IsInternalNetwork", "") + "").Equals("1");
|
||||||
LoginName = subKey.GetValue("LoginName", "") + "";
|
LoginName = subKey.GetValue("LoginName", "") + "";
|
||||||
@@ -383,37 +384,27 @@ namespace Lskj.Core
|
|||||||
/// <para>版本:1.0</para>
|
/// <para>版本:1.0</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||||
public bool CreateConnection(string Connection = "")
|
public bool CreateConnection(string Connection = "", ConnectionType connectionType = ConnectionType.SqlServer)
|
||||||
{
|
{
|
||||||
|
bool isConnect = false;
|
||||||
string connStr = GetConnection(Connection);
|
|
||||||
if (SqlHelper._connection != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SqlHelper._connection.Close();
|
|
||||||
SqlHelper._connection.Dispose();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
SqlHelper._connection = null;
|
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlHelper._connection = new SqlConnection(connStr);
|
string connStr = GetConnection(Connection);
|
||||||
SqlHelper._connection.Open();
|
//connectionType = ConnectionType.KdbnServer;
|
||||||
|
//connStr = "host=192.168.0.55;port=54321;database=test3;username=lserpAdmin;password=lserp110;";
|
||||||
|
//connectionType = ConnectionType.DmServer;
|
||||||
|
//connStr = "Server=192.168.0.55:5236; schema=DBO; UserId=LSERPADMIN; PWD=Lserp110";
|
||||||
|
string providerName = "System.Data.SqlClient";
|
||||||
|
SqlHelper.ConnectionType = ConnectionType.SqlServer;
|
||||||
|
if (connectionType == ConnectionType.KdbnServer)
|
||||||
|
{
|
||||||
|
providerName = "Kdbndp";
|
||||||
|
SqlHelper.ConnectionType = ConnectionType.KdbnServer;
|
||||||
|
}
|
||||||
|
else if (connectionType == ConnectionType.DmServer)
|
||||||
|
{
|
||||||
|
providerName = "Dm";
|
||||||
|
SqlHelper.ConnectionType = ConnectionType.DmServer;
|
||||||
|
}
|
||||||
|
SqlHelper.dbFactory = DbProviderFactories.GetFactory(providerName);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LogHelper.Instance.WriteLog(ex.Message);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+433
-258
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user