/// <summary> /// 查询程序更新 /// </summary> /// <param name="SQLString">查询程序更新</param> /// <returns>DataSet</returns> public static UpdateEXEUnit GetCheckEXE(UpdateEXEUnit unit) { using (OracleConnection connection = new OracleConnection(connectionStringOra)) { OracleCommand cmd = null; OracleDataReader reader = null; try { connection.Open(); cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT ID,NAME,LENGTH,TIME FROM PDA_UPDATEEXETABLE WHERE NAME=:NAME "; OracleParameter par1 = new OracleParameter("NAME", OracleType.NVarChar); par1.Value = unit.filename; cmd.Parameters.Add(par1); reader = cmd.ExecuteReader(); if (reader.Read() == true) { UpdateEXEUnit updateunnit = new UpdateEXEUnit(); updateunnit.id = reader.GetInt32(0); updateunnit.filename = reader.GetString(1); updateunnit.length = reader.GetInt32(2); updateunnit.time = reader.GetDateTime(3); return(updateunnit); } else { return(null); } } catch (System.Data.OracleClient.OracleException ex) { throw new Exception(ex.Message); } finally { if (reader != null) { reader.Close(); reader = null; } if (cmd != null) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } } } }
/// <summary> /// 查询程序更新列表 /// </summary> /// <param name="SQLString">查询程序更新列表</param> /// <returns>DataSet</returns> public static void GetCheckEXEList(List <UpdateEXEUnit> UpdateTableList) { using (OracleConnection connection = new OracleConnection(connectionStringOra)) { OracleCommand cmd = null; OracleDataReader reader = null; try { connection.Open(); cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT ID,NAME,LENGTH,TIME FROM PDA_UPDATEEXETABLE "; reader = cmd.ExecuteReader(); while (reader.Read() == true) { UpdateEXEUnit updateunnit = new UpdateEXEUnit(); updateunnit.id = reader.GetInt32(0); updateunnit.filename = reader.GetString(1); updateunnit.length = reader.GetInt32(2); updateunnit.time = reader.GetDateTime(3); UpdateTableList.Add(updateunnit); } } catch (System.Data.OracleClient.OracleException ex) { throw new Exception(ex.Message); } finally { if (reader != null) { reader.Close(); reader = null; } if (cmd != null) { cmd.Parameters.Clear(); cmd.Dispose(); cmd = null; } } } }