|
|
@@ -853,7 +853,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- command.Connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
result = new DataTable();
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill((DataTable)result);
|
|
|
@@ -862,13 +864,43 @@ namespace UAS_LabelMachine
|
|
|
//成功执行后将重复连接数置为0
|
|
|
break;
|
|
|
case "DELETE":
|
|
|
- result = command.ExecuteNonQuery();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
break;
|
|
|
case "UPDATE":
|
|
|
- result = command.ExecuteNonQuery();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
break;
|
|
|
case "INSERT":
|
|
|
- command.ExecuteNonQuery();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -876,31 +908,6 @@ namespace UAS_LabelMachine
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 为了同步BS端的条码维护,检测时允许问号的存在,在检测时默认将问号换成:Param参数
|
|
|
- /// </summary>
|
|
|
- /// <param name="SQL"></param>
|
|
|
- public bool CheckSQL(string SQL, out string ErrorMessage)
|
|
|
- {
|
|
|
- ErrorMessage = "";
|
|
|
- try
|
|
|
- {
|
|
|
- SQL = SQL.Replace("?", ":Param");
|
|
|
- command = new OracleCommand(SQL, connection);
|
|
|
- command.ExecuteNonQuery();
|
|
|
- command.Dispose();
|
|
|
- return true;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- command.Dispose();
|
|
|
- ErrorMessage = e.Message;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
public int GetDistinctRowCount(string TableName, string Field)
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
@@ -992,8 +999,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- command.Connection = new OracleConnection(DBConnectionString);
|
|
|
- command.Connection.Open();
|
|
|
+ connection= new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
command.Dispose();
|
|
|
@@ -1131,13 +1139,14 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- command.Connection = new OracleConnection(DBConnectionString);
|
|
|
- command.Connection.Open();
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
command.Dispose();
|
|
|
}
|
|
|
-
|
|
|
+ int count = 0;
|
|
|
/// <summary>
|
|
|
/// 调用存储过程
|
|
|
/// </summary>
|
|
|
@@ -1157,8 +1166,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- command.Connection = new OracleConnection(DBConnectionString);
|
|
|
- command.Connection.Open();
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
for (int i = 0; i < command.Parameters.Count; i++)
|
|
|
@@ -1185,8 +1195,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- command.Connection = new OracleConnection(DBConnectionString);
|
|
|
- command.Connection.Open();
|
|
|
+ connection = new OracleConnection(DBConnectionString);
|
|
|
+ connection.Open();
|
|
|
+ command.Connection = connection;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
command.Dispose();
|