I want a way to find out how many times a particular property page on my website is viewed.
The only way I can think of doing it, is to write an entry into the database each time the page is viewed.
If this is not the best method to do this, then I'd like to know the best practice.
I'm trying to do the following code, but it's not happening.
var sPropertyId = Request.QueryString["PropertyID"];
var views = "INSERT INTO PropertyViews (PropertyID, ViewTimestamp) VALUES (@0, GetDate())";
db.Execute = (views, sPropertyId);
It's OK, I've worked it out, partly with help from the link that Mike Brind posted. I was actually using an unnecessary =
character in there. The code that works is:
var sPropertyId = Request.QueryString["PropertyID"];
var views = "INSERT INTO PropertyViews (PropertyID, ViewTimestamp) VALUES (@0, GetDate())";
db.Execute(views, sPropertyId);