|
|
@@ -57,7 +57,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select " + Field + " from " + TableName + " where " + Condition;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter();
|
|
|
@@ -119,7 +119,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select count(1) from " + TableName + " where " + Condition;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
@@ -141,7 +141,7 @@ namespace UAS_MES.DataOperate
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
command.Dispose();
|
|
|
@@ -157,7 +157,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select ";
|
|
|
sql += AddField(Fields);
|
|
|
sql += " from " + TableName + " where " + Condition + " and rownum=1";
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
@@ -211,7 +211,6 @@ namespace UAS_MES.DataOperate
|
|
|
else
|
|
|
sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
|
|
|
}
|
|
|
- Console.WriteLine(sql.ToString());
|
|
|
command = new OracleCommand(sql.ToString(), connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
@@ -236,7 +235,7 @@ namespace UAS_MES.DataOperate
|
|
|
string sql = "select ";
|
|
|
sql += AddField(Fields);
|
|
|
sql += " from " + TableName + " where " + Condition;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
@@ -565,7 +564,7 @@ namespace UAS_MES.DataOperate
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
DataTable dt = new DataTable();
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
ad.Fill(dt);
|
|
|
ad.Dispose();
|
|
|
command.Dispose();
|
|
|
@@ -609,7 +608,7 @@ namespace UAS_MES.DataOperate
|
|
|
for (int i = 0; i < addpar.Length; i++)
|
|
|
command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
|
|
|
}
|
|
|
- Console.WriteLine(SQL);
|
|
|
+
|
|
|
switch (Type.ToUpper())
|
|
|
{
|
|
|
case "SELECT":
|
|
|
@@ -663,7 +662,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string sql = "select distinct count('" + Field + "') from " + TableName;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
@@ -694,7 +693,7 @@ namespace UAS_MES.DataOperate
|
|
|
public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
|
|
|
{
|
|
|
string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = DeleteID.Length;
|
|
|
@@ -841,7 +840,7 @@ namespace UAS_MES.DataOperate
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
command.ArrayBindCount = names[1].Length;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
//因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
|
|
|
//将第一个数组的下标固定为0作为循环添加的参数的名称
|
|
|
for (int i = 1; i <= names[0].Length; i++)
|
|
|
@@ -952,7 +951,7 @@ namespace UAS_MES.DataOperate
|
|
|
public string UpdateByCondition(string TableName, string update, string condition)
|
|
|
{
|
|
|
string sql = "update " + TableName + " set " + update + " where " + condition;
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command = new OracleCommand(sql, connection);
|
|
|
Reconnect(command);
|
|
|
command.ExecuteNonQuery();
|
|
|
@@ -996,7 +995,7 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
if (!String.IsNullOrEmpty(sql))
|
|
|
{
|
|
|
- Console.WriteLine(sql);
|
|
|
+
|
|
|
command.CommandText = sql;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|