If rs.recordcount < 0 Then Response.End


thats assuming that you are talking server side.