//------------------------------ // Obtener descripcion de Ubigeo //------------------------------ public string Get_Ubigeo(BE_ReqUbigeo Request) { string Item = ""; DA_Sistema Obj = new DA_Sistema(); Item = Obj.Get_Ubigeo(Request); return Item; }
// Obtengo Ubigeo public string Get_Ubigeo(BE_ReqUbigeo Request) { string Item = ""; try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "SELECT cDptDescripcion + '; ' + cPrvDescripcion + '; ' + cDisDescripcion as DPDUbigeo FROM Ubigeo_2007 WITH(NOLOCK) WHERE Codigo = '" + Request.Codigo + "'"; cm.CommandType = CommandType.Text; //cm.Parameters.AddWithValue("Codigo", Request.Codigo); cm.Connection = cn; using (SqlDataReader dr = cm.ExecuteReader()) { while (dr.Read()) { Item = dr.GetString(dr.GetOrdinal("DPDUbigeo")).Trim(); } } } } } catch (Exception) { throw; } return Item; }