/// <summary> /// 获取查询结果集 /// </summary> /// <param name="connetctionString">连接字符串</param> /// <param name="sql">sql语句</param> /// <returns>查询结果集</returns> public DataSet GetDataSet(string connetctionString, string sql) { DataSet dSet = new DataSet(); oUtil = new OracleUtil(connetctionString); dSet = oUtil.ExecuteQuery(sql); return(dSet); }
/// <summary> /// 获取查询结果集 /// </summary> /// <param name="sql">sql语句</param> /// <param name="obj">可选参数(第一个可选参数为数据库连接字符串)</param> /// <returns></returns> public DataSet GetDataSet(string sql, params object[] obj) { if (obj.Length > 0) { return(GetDataSet(obj[0].ToString(), sql)); } else { DataSet dSet = oUtil.ExecuteQuery(sql); return(dSet); } }
/// <summary> /// 获取正钻井领域模型集 /// </summary> /// <param name="wellName">井号</param> /// <returns>正钻井领域模型实体集</returns> public List <DrillingWell> GetDrillingWellList(string wellName) { string sql = @"select JHDM as WellID, JH as WellName, 井别 as WellType, JZT as WellStaus, X坐标 as XCoordinate, Y坐标 as YCoordinate from (SELECT JHDM, JH, JB 井别, '正钻井' AS JZT, CASE WHEN X2_6 IS NULL THEN X1_6 ELSE X2_6 END X坐标, CASE WHEN Y2_6 IS NULL THEN Y1_6 ELSE Y2_6 END Y坐标 FROM NEW_KTSJK.AJZH06 where jl like '%探井%' and substr(kzrq, 1, 4) = to_char(sysdate, 'yyyy') and wzrq is null)"; DataTable dTble = oUtil.ExecuteQuery(sql).Tables[0]; List <DrillingWell> dwList = new List <DrillingWell>(); for (int i = 0; i < dTble.Rows.Count; i++) { DrillingWell dw = new DrillingWell(); dw.WellID = dTble.Rows[i]["WellID"].ToString(); dw.WellName = dTble.Rows[i]["WellName"].ToString(); dw.WellStaus = dTble.Rows[i]["WellStaus"].ToString(); dw.WellType = dTble.Rows[i]["WellType"].ToString(); dw.XCoordinate = Convert.ToDouble(dTble.Rows[i]["XCoordinate"]); dw.YCoordinate = Convert.ToDouble(dTble.Rows[i]["YCoordinate"]); dwList.Add(dw); dw = null; } return(dwList); }