You can use simple variable to fetch count from database & again increment this count if hit ocurs for certain page & persist/update this into database.
In second method you can use variable with application scope to hold count of the visits to certain page in your application. But drawback of this method is that it will hold count only untill your server is alive/running. Once you restart your server the "application" variable gets reset. So you need to implement some method to persist this variable in regular inerval of time into database.
********Deserve Before You Desire********
subject: Calculating number of hits that my web-application has received.