|
|
@@ -57,7 +57,6 @@ 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();
|
|
|
@@ -100,7 +99,6 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
command.Parameters.Add("Param" + i, OracleDbType.Varchar2, Parameters[i], ParameterDirection.Input);
|
|
|
}
|
|
|
-
|
|
|
OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
DataTable dt = new DataTable();
|
|
|
ad.Fill(dt);
|
|
|
@@ -119,7 +117,6 @@ 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 +138,6 @@ 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 +153,6 @@ 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);
|
|
|
@@ -167,22 +162,6 @@ namespace UAS_MES.DataOperate
|
|
|
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++)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 按分页获取数据
|
|
|
/// </summary>
|
|
|
@@ -211,7 +190,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 +214,6 @@ 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 +542,6 @@ 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 +585,6 @@ 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 +638,6 @@ 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 +668,6 @@ 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;
|
|
|
@@ -824,7 +797,6 @@ 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++)
|
|
|
@@ -935,7 +907,6 @@ 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();
|
|
|
@@ -979,7 +950,6 @@ namespace UAS_MES.DataOperate
|
|
|
{
|
|
|
if (!String.IsNullOrEmpty(sql))
|
|
|
{
|
|
|
- Console.WriteLine(sql);
|
|
|
command.CommandText = sql;
|
|
|
command.ExecuteNonQuery();
|
|
|
}
|