|
|
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|
|
using System.Configuration;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
+using System.Windows;
|
|
|
using UAS_MES.PublicMethod;
|
|
|
|
|
|
namespace UAS_MES.DataOperate
|
|
|
@@ -31,6 +32,8 @@ namespace UAS_MES.DataOperate
|
|
|
else
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
+ command = new OracleCommand();
|
|
|
+ command.Connection = connection;
|
|
|
}
|
|
|
catch (Exception e) { LogManager.DoLog(e.Message); }
|
|
|
}
|
|
|
@@ -41,12 +44,12 @@ namespace UAS_MES.DataOperate
|
|
|
public DataTable GetColumnDataType(string TableName)
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
- command = new OracleCommand("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", connection);
|
|
|
+ command.CommandText = "select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')";
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return dt;
|
|
|
}
|
|
|
|
|
|
@@ -57,7 +60,8 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select " + Field + " from " + TableName + " where " + Condition;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
@@ -69,13 +73,13 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
}
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
+
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
return dt.Rows[0][0];
|
|
|
@@ -105,8 +109,8 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
sb.Append(Param[i] + ":Param" + i);
|
|
|
}
|
|
|
- command = new OracleCommand(sb.ToString(), connection);
|
|
|
-
|
|
|
+ command.CommandText = sb.ToString();
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
for (int i = 0; i < ParamNum; i++)
|
|
|
{
|
|
|
command.Parameters.Add("Param" + i, OracleDbType.Varchar2, Parameters[i], ParameterDirection.Input);
|
|
|
@@ -115,7 +119,7 @@ namespace UAS_MES.DataOperate
|
|
|
DataTable dt = new DataTable();
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
return dt;
|
|
|
}
|
|
|
return "参数错误,请检查SQL语句";
|
|
|
@@ -129,12 +133,12 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select count(1) from " + TableName + " where " + Condition;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return int.Parse(dt.Rows[0][0].ToString());
|
|
|
}
|
|
|
|
|
|
@@ -147,13 +151,12 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select count(1) from " + TableName;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
-
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return int.Parse(dt.Rows[0][0].ToString());
|
|
|
}
|
|
|
|
|
|
@@ -166,7 +169,8 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select ";
|
|
|
sql += AddField(Fields);
|
|
|
sql += " from " + TableName + " where " + Condition + " and rownum=1";
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
try
|
|
|
@@ -177,30 +181,14 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
}
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
- return dt;
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 将DataTable导入到指定的表中
|
|
|
- /// </summary>
|
|
|
- /// <param name="DataTable"></param>
|
|
|
- /// <param name="TableName"></param>
|
|
|
- public void InsertDataTable(DataTable DataTable, string TableName)
|
|
|
- {
|
|
|
- for (int i = 0; i < DataTable.Rows.Count; i++)
|
|
|
- {
|
|
|
- for (int j = 0; j < DataTable.Columns.Count; j++)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ return dt;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -231,12 +219,13 @@ namespace UAS_MES.DataOperate
|
|
|
else
|
|
|
sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
|
|
|
}
|
|
|
- command = new OracleCommand(sql.ToString(), connection);
|
|
|
+ command.CommandText = sql.ToString();
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
+
|
|
|
dt.Columns.RemoveAt(0);
|
|
|
foreach (DataColumn dc in dt.Columns)
|
|
|
{
|
|
|
@@ -255,8 +244,8 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select ";
|
|
|
sql += AddField(Fields);
|
|
|
sql += " from " + TableName + " where " + Condition;
|
|
|
-
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
try
|
|
|
@@ -267,13 +256,13 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
}
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
+
|
|
|
return dt;
|
|
|
}
|
|
|
|
|
|
@@ -286,7 +275,8 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select ";
|
|
|
sql += Fields;
|
|
|
sql += " from " + TableName;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
ad.SelectCommand = command;
|
|
|
@@ -298,13 +288,12 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
}
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return dt;
|
|
|
}
|
|
|
|
|
|
@@ -397,7 +386,7 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
sb.Remove(sb.Length - 1, 1);
|
|
|
sb.Append(" where " + PrimaryKey + "=:" + PrimaryKey);
|
|
|
- command = new OracleCommand(sb.ToString(), connection);
|
|
|
+ command.CommandText = sb.ToString();
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
// 参数的长度是DataTable的行数决定的
|
|
|
command.ArrayBindCount = DataTable.Rows.Count;
|
|
|
@@ -426,47 +415,7 @@ namespace UAS_MES.DataOperate
|
|
|
ad.UpdateCommand = command;
|
|
|
ad.Update(DataTable);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取DbFind的数据的DataTable的结构
|
|
|
- /// </summary>
|
|
|
- /// <param name="field"></param>
|
|
|
- /// <param name="caller"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public DataTable GetDbFindDataTable(string field, string caller)
|
|
|
- {
|
|
|
- string sql = "select * from dbfindsetui where ds_caller='" + caller + "' and ds_whichui='" + field + "'";
|
|
|
- DataTable dt = (DataTable)ExecuteSql(sql, "select");
|
|
|
- if (dt.Rows.Count != 0)
|
|
|
- {
|
|
|
- //通过#号分割字段
|
|
|
- string[] dbfield = dt.Rows[0]["ds_findtoui"].ToString().Split('#');
|
|
|
- string[] cnfield = dt.Rows[0]["ds_dbcaption"].ToString().Split('#');
|
|
|
- //获取查询要查询的Table
|
|
|
- string dbtable = dt.Rows[0]["ds_tables"].ToString();
|
|
|
- //拼接查询的字段
|
|
|
- for (int i = 0; i < dbfield.Length; i++)
|
|
|
- {
|
|
|
- dbfield[i] = dbfield[i].Split(',')[0];
|
|
|
- }
|
|
|
- //新建一个空的DataTable
|
|
|
- DataTable dt1 = new DataTable();
|
|
|
- //往空的DataTable添加结构,ColumnName是中文,Caption是实际的字段名称
|
|
|
- for (int i = 0; i < cnfield.Length; i++)
|
|
|
- {
|
|
|
- dt1.Columns.Add(cnfield[i]);
|
|
|
- dt1.Columns[i].Caption = dbfield[i];
|
|
|
- }
|
|
|
- //返回一个带有结构的空的DataTable
|
|
|
- //DbFind.BindTable1 = dbtable;
|
|
|
- return dt1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -478,13 +427,13 @@ namespace UAS_MES.DataOperate
|
|
|
public bool CheckExist(string TableName, string Condition)
|
|
|
{
|
|
|
string sql = "select count(1) from " + TableName + " where " + Condition;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
DataTable dt = new DataTable();
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return int.Parse(dt.Rows[0][0].ToString()) > 0;
|
|
|
}
|
|
|
|
|
|
@@ -497,7 +446,8 @@ namespace UAS_MES.DataOperate
|
|
|
public object ExecuteSql(string SQL, string Type, params object[] names)
|
|
|
{
|
|
|
object result = null;
|
|
|
- command = new OracleCommand(SQL, connection);
|
|
|
+ command.CommandText = SQL;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
//用来拼接参数的
|
|
|
if (names.Length > 0)
|
|
|
@@ -538,7 +488,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(SQL, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill((DataTable)result);
|
|
|
@@ -547,13 +497,13 @@ namespace UAS_MES.DataOperate
|
|
|
case "DELETE":
|
|
|
try
|
|
|
{
|
|
|
- result=command.ExecuteNonQuery();
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
command.Connection = new OracleConnection(DBConnectionString);
|
|
|
command.Connection.Open();
|
|
|
- result=command.ExecuteNonQuery();
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
}
|
|
|
break;
|
|
|
case "UPDATE":
|
|
|
@@ -581,7 +531,7 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -592,16 +542,17 @@ namespace UAS_MES.DataOperate
|
|
|
public void CheckSQL(string SQL)
|
|
|
{
|
|
|
SQL = SQL.Replace("?", ":Param");
|
|
|
- command = new OracleCommand(SQL, connection);
|
|
|
+ command.CommandText = SQL;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
command.ExecuteNonQuery();
|
|
|
- command.Dispose();
|
|
|
}
|
|
|
|
|
|
public int GetDistinctRowCount(string TableName, string Field)
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select distinct count('" + Field + "') from " + TableName;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
try
|
|
|
@@ -612,13 +563,12 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
}
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
return int.Parse(dt.Rows[0][0].ToString());
|
|
|
}
|
|
|
|
|
|
@@ -643,8 +593,7 @@ namespace UAS_MES.DataOperate
|
|
|
public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
|
|
|
{
|
|
|
string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
|
|
|
-
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = DeleteID.Length;
|
|
|
command.Parameters.Add(new OracleParameter("DeleteID", OracleDbType.Long, DeleteID, ParameterDirection.Input));
|
|
|
@@ -658,7 +607,7 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -796,10 +745,9 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="names"></param>
|
|
|
public void BatchInsert(string sql, params object[][] names)
|
|
|
{
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = names[1].Length;
|
|
|
-
|
|
|
//因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
|
|
|
//将第一个数组的下标固定为0作为循环添加的参数的名称
|
|
|
for (int i = 1; i <= names[0].Length; i++)
|
|
|
@@ -816,12 +764,12 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
|
|
|
{
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = param1[0].Length;
|
|
|
//因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
|
|
|
@@ -840,7 +788,7 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -898,7 +846,6 @@ namespace UAS_MES.DataOperate
|
|
|
return dt1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 通过条件更新
|
|
|
/// </summary>
|
|
|
@@ -908,7 +855,8 @@ namespace UAS_MES.DataOperate
|
|
|
public string UpdateByCondition(string TableName, string update, string condition)
|
|
|
{
|
|
|
string sql = "update " + TableName + " set " + update + " where " + condition;
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
try
|
|
|
{
|
|
|
@@ -920,7 +868,6 @@ namespace UAS_MES.DataOperate
|
|
|
command.Connection.Open();
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
return sql;
|
|
|
}
|
|
|
|
|
|
@@ -931,11 +878,9 @@ namespace UAS_MES.DataOperate
|
|
|
/// <param name="param"></param>
|
|
|
public void CallProcedure(string ProcedureName, ref string[] param)
|
|
|
{
|
|
|
- command = new OracleCommand(ProcedureName);
|
|
|
- command.Connection = connection;
|
|
|
- Reconnect(command);
|
|
|
command.CommandText = ProcedureName;
|
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
|
+ Reconnect(command);
|
|
|
for (int i = 0; i < param.Length; i++)
|
|
|
command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
|
|
|
try
|
|
|
@@ -950,7 +895,7 @@ namespace UAS_MES.DataOperate
|
|
|
}
|
|
|
for (int i = 0; i < command.Parameters.Count; i++)
|
|
|
param[i] = command.Parameters[i].Value.ToString();
|
|
|
- command.Dispose();
|
|
|
+ command.Parameters.Clear();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -960,8 +905,6 @@ namespace UAS_MES.DataOperate
|
|
|
public void ExecuteSQLTran(params string[] SQL)
|
|
|
{
|
|
|
OracleTransaction tx = connection.BeginTransaction();
|
|
|
- command = new OracleCommand();
|
|
|
- command.Connection = connection;
|
|
|
command.Transaction = tx;
|
|
|
try
|
|
|
{
|
|
|
@@ -970,6 +913,7 @@ namespace UAS_MES.DataOperate
|
|
|
if (!String.IsNullOrEmpty(sql))
|
|
|
{
|
|
|
command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
try
|
|
|
{
|
|
|
command.ExecuteNonQuery();
|
|
|
@@ -989,7 +933,6 @@ namespace UAS_MES.DataOperate
|
|
|
tx.Rollback();
|
|
|
throw new Exception(E.Message);
|
|
|
}
|
|
|
- command.Dispose();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1039,7 +982,8 @@ namespace UAS_MES.DataOperate
|
|
|
public object GetLabelParam(string sql)
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.CommandText = sql;
|
|
|
+ command.CommandType = CommandType.Text;
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
@@ -1051,7 +995,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
connection = new OracleConnection(DBConnectionString);
|
|
|
connection.Open();
|
|
|
- command = new OracleCommand(sql, connection);
|
|
|
+ command.Connection = connection;
|
|
|
ad = new OracleDataAdapter();
|
|
|
ad.SelectCommand = command;
|
|
|
ad.Fill(dt);
|
|
|
@@ -1059,12 +1003,11 @@ namespace UAS_MES.DataOperate
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
ad.Dispose();
|
|
|
- command.Dispose();
|
|
|
+
|
|
|
return dt.Rows[0][0];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- command.Dispose();
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
@@ -1102,7 +1045,8 @@ namespace UAS_MES.DataOperate
|
|
|
|
|
|
public void Dispose()
|
|
|
{
|
|
|
-
|
|
|
+ command.Dispose();
|
|
|
+ connection.Dispose();
|
|
|
}
|
|
|
|
|
|
private void Reconnect(OracleCommand cmd)
|