|
|
@@ -34,6 +34,7 @@ namespace UAS_MES.DataOperate
|
|
|
connection.Open();
|
|
|
command = new OracleCommand();
|
|
|
command.Connection = connection;
|
|
|
+ command.CommandTimeout = 0;
|
|
|
}
|
|
|
catch (Exception e) { LogManager.DoLog(e.Message); }
|
|
|
}
|
|
|
@@ -98,6 +99,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <returns></returns>
|
|
|
public object ExecutePrintSQL(string SQL, params string[] Parameters)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
//按照?拆分数据,然后以:Param替换问号,同时添加参数
|
|
|
string[] Param = SQL.Split('?');
|
|
|
int ParamNum = Param.Length - 1;
|
|
|
@@ -119,7 +121,6 @@ namespace UAS_MES.DataOperate
|
|
|
DataTable dt = new DataTable();
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Parameters.Clear();
|
|
|
return dt;
|
|
|
}
|
|
|
return "参数错误,请检查SQL语句";
|
|
|
@@ -305,6 +306,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="Condition"></param>
|
|
|
public void UpDateTableByCondition(DataTable DataTable, string TableName, string PrimaryKey, params string[] sql)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
if (DataTable == null)
|
|
|
{
|
|
|
return;
|
|
|
@@ -415,7 +417,7 @@ namespace UAS_MES.DataOperate
|
|
|
ad.UpdateCommand = command;
|
|
|
ad.Update(DataTable);
|
|
|
ad.Dispose();
|
|
|
- command.Parameters.Clear();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -445,6 +447,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <returns></returns>
|
|
|
public object ExecuteSql(string SQL, string Type, params object[] names)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
object result = null;
|
|
|
command.CommandText = SQL;
|
|
|
command.CommandType = CommandType.Text;
|
|
|
@@ -531,7 +534,6 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- command.Parameters.Clear();
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -592,6 +594,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="DeleteID">需要删除主键ID的数组</param>
|
|
|
public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
|
|
|
command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
@@ -607,7 +610,6 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -745,6 +747,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="names"></param>
|
|
|
public void BatchInsert(string sql, params object[][] names)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = names[1].Length;
|
|
|
@@ -764,11 +767,11 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = param1[0].Length;
|
|
|
@@ -788,7 +791,6 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -878,6 +880,7 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="param"></param>
|
|
|
public void CallProcedure(string ProcedureName, ref string[] param)
|
|
|
{
|
|
|
+ command.Parameters.Clear();
|
|
|
command.CommandText = ProcedureName;
|
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
|
Reconnect(command);
|
|
|
@@ -895,7 +898,7 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
for (int i = 0; i < command.Parameters.Count; i++)
|
|
|
param[i] = command.Parameters[i].Value.ToString();
|
|
|
- command.Parameters.Clear();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|