Based on just the code you have above... You dont need the select * from Library. You also dont need to have so many sets and selects.
try just
Select Count(*) As TotalCount FROM bookissue WHERE bookid = @book_id AND stuid = @stud_id
At a guess that will only tell you the number of times that particular book has been issued to that student.
You will most likely need to take into account if the database stores the book being OnSite or Offsite based on a flag on each record, or a new record for each transaction.
If you want to return a count of all books in the library you would need to link some tables, but without more information I cant help.