private void FillLocationEntity() { 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='LOC' 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); LstLocation.DataValueField = "ID"; LstLocation.DataTextField = "NAME"; LstLocation.DataSource = thisDataSet.Tables[0]; LstLocation.DataBind(); }
private void FillLocationEntity() { 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='LOC' 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); LstLocation.DataValueField = "ID"; LstLocation.DataTextField = "NAME"; LstLocation.DataSource = thisDataSet.Tables[0]; LstLocation.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"); } }