Print Page | Close Window

Counting Clicks on a Web Site

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=18055
Printed Date: 28 March 2026 at 1:39pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Counting Clicks on a Web Site
Posted By: Misty
Subject: Counting Clicks on a Web Site
Date Posted: 20 January 2006 at 6:43am
Please go to http://www.explorencmountains.com/Category.aspx?CatID=76 for an example. If you click on "Get More Information About ______", it will add one to the views for that listing. I know how to do that. But I'd like to be able to count how many people have viewed the company's web site from my web site. I am not sure how to do this.

My code for counting the hits to the listing itself (displayadvertiser.aspx) on my web site is:
 
SqlCmd.CommandText = String.Format("UPDATE Advertiser SET Views = Views + 1 WHERE AdvertiserID = '{0}'", strAdID)
 
This used a querystring so this is different. Could someone please help me? The code needs to be done in VB.Net/ASP.Net.



Replies:
Posted By: mack
Date Posted: 28 January 2006 at 2:45am
Why are you using String.format? I never used that.

When the user clicks, you will need to do this:
SqlCmd.CommandText = "UPDATE Advertiser SET views = Views + 1 WHERE AdvertisterID = '{0}'", strAdId

What I like to do is output the SQL statement to an Response.Write, then test the output in my database program (SQL Manager Express from microsoft).

You can also try grabbing the # of views from the database with a SELECT, setting it to a variable, then adding one to it, and then updating it like that with almost the same SQL statement.

Edit: What was the error?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net