public bean.BibliotecaLibros getPrestamo( String pstr_codigo, int pint_anio) { var obj_biblioteca = new bean.BibliotecaLibros(); SqlCommand cmd=new SqlCommand(); cmd.Connection=con; cmd.CommandType=CommandType.StoredProcedure; cmd.CommandText= "MA_USP_GET_LIBROS"; cmd.Parameters.Add( "@codigo",SqlDbType.VarChar,8).Value=pstr_codigo; cmd.Parameters.Add("@anio",SqlDbType.Int).Value= pint_anio; try{ if(con.State== ConnectionState.Closed){ con.Open(); } SqlDataReader dr = cmd.ExecuteReader(); while(dr.Read()){ obj_biblioteca.str_mensaje= dr[0].ToString(); obj_biblioteca.int_valor = int.Parse( dr[1].ToString() ); } }finally{ con.Close(); } return obj_biblioteca; }
public bean.BibliotecaLibros getPrestamo(String pstr_codigo, int pint_anio) { var obj_biblioteca = new bean.BibliotecaLibros(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "MA_USP_GET_LIBROS"; cmd.Parameters.Add("@codigo", SqlDbType.VarChar, 8).Value = pstr_codigo; cmd.Parameters.Add("@anio", SqlDbType.Int).Value = pint_anio; try{ if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { obj_biblioteca.str_mensaje = dr[0].ToString(); obj_biblioteca.int_valor = int.Parse(dr[1].ToString()); } }finally{ con.Close(); } return(obj_biblioteca); }