public void dropDownCategory(string catCode)
{
String strCategoryCode = String.Empty;
OracleConnection oracleConn = new OracleConnection();
oracleConn.ConnectionString = ConfigurationManager.ConnectionStrings["oracleConnectionString"].ConnectionString;
OracleDataReader ordr;
string mySql = "SELECT CATEGORY_CD,CATEGORY_DESC,CATEGORY_ID FROM OGC_CATEGORY_LU WHERE CATEGORY_CD = :catCode";
oracleConn.Open();
using (OracleCommand cmd = new OracleCommand(mySql, oracleConn))
{
cmd.Parameters.AddWithValue(":catCode", catCode.ToString());
ordr = cmd.ExecuteReader();
ordr.Read();
if (strCategoryCode.ToString() == string.Empty)
{
strCategoryCode = ordr["CATEGORY_CD"].ToString();
}
else
{
ed_catCode.Text = ordr["CATEGORY_ID"].ToString();
ed_catDesc.Text = ordr["CATEGORY_DESC"].ToString();
}
ordr.Close();
oracleConn.Close();
}
try
{
oracleConn.Open();
string sql = "SELECT CATEGORY_CD,CATEGORY_DESC,CATEGORY_ID FROM OGC_CATEGORY_LU";
OracleCommand cmdCD = new OracleCommand(sql, oracleConn);
ed_catCode.DataSource = cmdCD.ExecuteReader();
ed_catCode.DataTextField = "CATEGORY_CD";
ed_catCode.DataValueField = "CATEGORY_CD";
ed_catCode.SelectedValue = strCategoryCode.ToString();
ed_catCode.DataBind();
}
catch (Exception er)
{
error.Text += er.Message;
}
finally
{
oracleConn.Close();
}
}
|