//metodo insertar
        public string Insertar(DSexo Sexo)
        {//inicio insertar
            string        rpta   = "";
            SqlConnection SqlCon = new SqlConnection();

            try
            {
                //conexion
                SqlCon.ConnectionString = Conexion.Cn;
                SqlCon.Open();
                //establecer el comando
                SqlCommand SqlCmd = new SqlCommand();
                SqlCmd.Connection  = SqlCon;
                SqlCmd.CommandText = "spinsertar_sexo";
                SqlCmd.CommandType = CommandType.StoredProcedure;

                //parametros
                SqlParameter ParId_Sexo = new SqlParameter();
                ParId_Sexo.ParameterName = "@id_sexo";
                ParId_Sexo.SqlDbType     = SqlDbType.Int;
                ParId_Sexo.Direction     = ParameterDirection.Output;
                SqlCmd.Parameters.Add(ParId_Sexo);

                SqlParameter ParSexo = new SqlParameter();
                ParSexo.ParameterName = "@sexo";
                ParSexo.SqlDbType     = SqlDbType.VarChar;
                ParSexo.Size          = 50;
                ParSexo.Value         = Sexo.Sexo;
                SqlCmd.Parameters.Add(ParSexo);


                //ejecutar el codigo
                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "EL REGISTRO NO HA SIDO AGREGADO";
            }
            catch (Exception ex)
            {
                rpta = ex.Message + ex.StackTrace;
            }
            finally
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
            }
            return(rpta);
        }//fin insertar
        }//fin editar

        //metodo eliminar
        public string Eliminar(DSexo Sexo)
        {//inicio eliminar
            string        rpta   = "";
            SqlConnection SqlCon = new SqlConnection();

            try
            {
                //conexion
                SqlCon.ConnectionString = Conexion.Cn;
                SqlCon.Open();
                //establecer el comando
                SqlCommand SqlCmd = new SqlCommand();
                SqlCmd.Connection  = SqlCon;
                SqlCmd.CommandText = "speliminar_sexo";
                SqlCmd.CommandType = CommandType.StoredProcedure;

                //parametros
                SqlParameter ParId_Sexo = new SqlParameter();
                ParId_Sexo.ParameterName = "@id_sexo";
                ParId_Sexo.SqlDbType     = SqlDbType.Int;
                ParId_Sexo.Value         = Sexo.Id_sexo;
                SqlCmd.Parameters.Add(ParId_Sexo);

                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "NO SE HA ELIMINADO EL REGISTRO";
            }
            catch (Exception ex)
            {
                rpta = ex.Message + ex.StackTrace;
            }
            finally
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
            }
            return(rpta);
        }//fin eliminar