void queryData(string strQuery, string Env) { dtParam = this.GetParam(strQuery); DataSet ds = new DataSet(); if (dtParam != null && dtParam.Rows.Count > 0) { frmSqlExcuteParam frm = new frmSqlExcuteParam(); frm.dtParam = this.dtParam; frm.ssql = strQuery; DialogResult dis = frm.ShowDialog(); if (dis.Equals(DialogResult.OK)) { this.dtParam = frm.dtParam; OracleCommand cmd = new OracleCommand(); cmd.CommandText = strQuery; if (dtParam != null & dtParam.Rows.Count > 0) { foreach (DataRow dr in dtParam.Rows) { if (string.IsNullOrEmpty(dr["Param"].ToString().Trim())) { continue; } cmd.Parameters.Add(new OracleParameter(dr["Param"].ToString(), dr["Value"])); } } if (Env.ToUpper().Equals("PROD")) { ds = oraProdEnv.GetDataSet(cmd); dgvProdEnv.DataSource = ds.Tables[0]; } else { ds = oraTestEnv.GetDataSet(cmd); dgvTestEnv.DataSource = ds.Tables[0]; } } } else { if (Env.ToUpper().Equals("PROD")) { ds = oraProdEnv.GetDataSet(strQuery); dgvProdEnv.DataSource = ds.Tables[0]; } else { ds = oraTestEnv.GetDataSet(strQuery); dgvTestEnv.DataSource = ds.Tables[0]; } } }
private DataSet GetCustomQueryDetail(OracleHelpMes ora, string queryid, string version) { string ssql = @"SELECT QUERYID, VERSION, QUERYSTRING, OLDQUERYSTRING, DESCRIPTION, LASTEVENTUSER, LASTEVENTDATE FROM CT_CUSTOMQUERY WHERE NVL (QUERYID, ' ') LIKE :QUERYID AND NVL (VERSION, ' ') LIKE :VERSION"; OracleCommand cmd = new OracleCommand(); cmd.CommandText = ssql; if (string.IsNullOrEmpty(queryid)) { queryid = "%"; } cmd.Parameters.Add(new OracleParameter("QUERYID", queryid)); cmd.Parameters.Add(new OracleParameter("VERSION", version + "%")); DataSet ds = ora.GetDataSet(cmd); return(ds); }
private List <string> GetCustomQueryList(OracleHelpMes ora) { List <string> lstStr = new List <string>(); string ssql = "SELECT DISTINCT(QUERYID) FROM CT_CUSTOMQUERY order by QUERYID"; DataSet ds = ora.GetDataSet(ssql); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { lstStr.Add(dr["QUERYID"].ToString()); } } return(lstStr); }