Bytes Expert Newtork: Connect with experts in IT / Business | Expert Topics



Search


Go Back   Programmers Resource > Code Section > ASP Tips & Code Snippets
User Name
Password


 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 09-16-2006, 09:10 PM
twalter twalter is offline
Registered User
 
Join Date: Jul 2003
Location: Masssachusetts
Posts: 94
Simple Counter

Create a table called tblcounter with one field called counterid as shown in here:


----------copy and pase below this line to a new file and save it as counter.inc----------
<%

dim counter, c, r, q, s
set c = server.CreateObject("ADODB.Connection")
set r = server.CreateObject("ADODB.Recordset")
c.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("counter.mdb") & ";"

s = "Select * From tblcounter"
set r = c.Execute (s)

counter = counter + r("counterid") + 1
response.write "<b><font color=""#006599"">" & counter & "</font></b>"
q = "Update tblcounter Set counterid = '" & counter & "' WHERE counterid = " & r("counterid") & " "
c.Execute(q)
%>
----------end copy and paste---------

Add this to your page using the include statement <!--#include file="counter.inc"-->

See the example here

Download the demo here
__________________
__________________
Tom Walter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 08:07 AM.



Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All content Copyright ©1999 - 2010, Programmers Resource, unless otherwise noted.