Forums

ASP

This topic is locked

update count in a DB

Posted 11 Apr 2002 16:08:52
1
has voted
11 Apr 2002 16:08:52 Tom Ka posted:
Hello

I publish artikels on a site and want to have a simple DB-based counter.
My idea is, that every time a guest views a page a numeric db-field will count +1 . (articelviews +1 by artikelID)
my question: is it possible to do this without reading the current value out of the db, adding +1 with asp and updating the db?
So: just a code which opens the db and give the counterfield +1 appropriate to the articelID ???

Thanks for your help
Tom

Edited by - mmtom on 12 Apr 2002 07:53:24

Replies

Replied 12 Apr 2002 09:34:15
12 Apr 2002 09:34:15 Viktor Farcic replied:
Create Command/Stored Procedure that will update the table every time page loads. SQL should look something like:
UPDATE TableName SET articelviews = articelviews + 1 WHERE ID = Request.QueryString("ID"

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hello

I publish artikels on a site and want to have a simple DB-based counter.
My idea is, that every time a guest views a page a numeric db-field will count +1 . (articelviews +1 by artikelID)
my question: is it possible to do this without reading the current value out of the db, adding +1 with asp and updating the db?
So: just a code which opens the db and give the counterfield +1 appropriate to the articelID ???

Thanks for your help
Tom

Edited by - mmtom on 12 Apr 2002 07:53:24
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 12 Apr 2002 12:17:34
12 Apr 2002 12:17:34 Tom Ka replied:
Hi and Thanks

just for my understanding:
I open the db as usualy (set object... open)
then I create a sql-string as described (UPDATE...) and execute this. ?
Replied 13 Apr 2002 14:00:39
13 Apr 2002 14:00:39 Viktor Farcic replied:
Probably it's easiest if you use Data Bindings &gt; Command (Stored Procedure)

Viktor Farcic

TalkZone Manager

Reply to this topic