private void FillDivisionEntity() { string strSql = ""; strSql = "SELECT oce_id as ID,replace(convert(char(20),ltrim(OCE_DESCRIPTION )) + oce_id,' ',' ' ) as NAME FROM ent_org_common_entities where cem_entity_id='DIV' and oce_isdeleted='0'"; SqlConnection con = new SqlConnection(m_connections); con.Open(); SqlCommand cmd = new SqlCommand(strSql, con); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); LstDivision.DataValueField = "ID"; LstDivision.DataTextField = "NAME"; LstDivision.DataSource = thisDataSet.Tables[0]; LstDivision.DataBind(); }
private void FillDivisionEntity() { try { string strSql = ""; strSql = "SELECT oce_id as ID,replace(convert(char(20),ltrim(OCE_DESCRIPTION )) + oce_id,' ',' ' ) as NAME FROM ent_org_common_entities where cem_entity_id='DIV' and oce_isdeleted='0'"; if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = new SqlCommand(strSql, conn); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); LstDivision.DataValueField = "ID"; LstDivision.DataTextField = "NAME"; LstDivision.DataSource = thisDataSet.Tables[0]; LstDivision.DataBind(); if (conn.State == ConnectionState.Open) { conn.Close(); } } catch (Exception ex) { if (conn.State == ConnectionState.Open) { conn.Close(); } UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchyAdd"); } }