|
|
@@ -121,6 +121,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select count(1) from " + TableName + " where " + Condition;
|
|
|
Console.WriteLine(sql);
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
@@ -138,6 +139,7 @@ namespace UAS_MES.DataOperate
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select count(1) from " + TableName;
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
Console.WriteLine(sql);
|
|
|
ad.Fill(dt);
|
|
|
@@ -211,6 +213,7 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
Console.WriteLine(sql.ToString());
|
|
|
command = new OracleCommand(sql.ToString(), connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
@@ -662,6 +665,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select distinct count('" + Field + "') from " + TableName;
|
|
|
Console.WriteLine(sql);
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
@@ -692,6 +696,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
|
|
|
Console.WriteLine(sql);
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
command.ArrayBindCount = DeleteID.Length;
|
|
|
command.Parameters.Add(new OracleParameter("DeleteID", OracleDbType.Long, DeleteID, ParameterDirection.Input));
|
|
|
command.ExecuteNonQuery();
|
|
|
@@ -817,6 +822,7 @@ namespace UAS_MES.DataOperate
|
|
|
public void BatchInsert(string sql, params object[][] names)
|
|
|
{
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
command.ArrayBindCount = names[1].Length;
|
|
|
Console.WriteLine(sql);
|
|
|
//因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
|
|
|
@@ -832,6 +838,7 @@ namespace UAS_MES.DataOperate
|
|
|
public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
|
|
|
{
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
command.ArrayBindCount = param1[0].Length;
|
|
|
//因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
|
|
|
//将第一个数组的下标固定为0作为循环添加的参数的名称
|
|
|
@@ -855,6 +862,7 @@ namespace UAS_MES.DataOperate
|
|
|
DataTable dt = new DataTable();
|
|
|
string SQL = " select listagg(dld_field,',') within group (order by dld_id) from datalistdetail where dld_caller='" + Caller + "'";
|
|
|
command = new OracleCommand(SQL, connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
@@ -929,6 +937,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "update " + TableName + " set " + update + " where " + condition;
|
|
|
Console.WriteLine(sql);
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
command.ExecuteNonQuery();
|
|
|
command.Dispose();
|
|
|
return sql;
|
|
|
@@ -943,7 +952,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
command = new OracleCommand(ProcedureName);
|
|
|
command.Connection = connection;
|
|
|
- //Reconnect(command);
|
|
|
+ Reconnect(command);
|
|
|
command.CommandText = ProcedureName;
|
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
|
for (int i = 0; i < param.Length; i++)
|
|
|
@@ -1033,6 +1042,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|