Now what do I do?

OK, I was able to create a database using the SQL Management tool easy enough. I called it HitCounter.

I created a table, no problem, called it HitTable, so I want to connect to the database from inside my web server.

I made 3 columns, IP, Hits, and Last to generate a modicum of statistics as a test case.

Also, I presume its easy enough to change the database as I think of something to add.

 

here is the code so far, icky as it is.....

 

<html>
<head>
<%
Dim strServername, strLocalname, strServerIP

strServername = LCase(Request.ServerVariables("SERVER_NAME"))   ' Server's name
strServerIP = LCase(Request.ServerVariables("LOCAL_ADDR"))      ' Server's IP address
strRemoteIP =  LCase(Request.ServerVariables("REMOTE_ADDR"))    ' Client's IP address

'LOCK light cause a problem with a lot of hits
Application.Lock
counter = Application("counter")
counter = counter + 1
Application("counter") = counter
Application.Unlock
%>

<title>Green Relations Group</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="en-us">
<meta name="robots" content="ALL, INDEX, FOLLOW">
<meta name="description" content="Green Relations provides Corporate Communications, Public Relations & Investor Relations services.">
<meta name="keywords" content="global, finance, communications, stock, market, money, gold, commodities, 101, spin, doctor">
</head>

<body bgcolor="#00CC66">
<ul>
 <li><font size="5"><a href="cc.asp">Corporate Communications</a></font></li>
 <li><font size="5"><a href="ir.asp">Public Relations</a></font></li>
 <li><font size="5"><a href="ir.asp">Investor Relations</a></font></li>
 <li><font size="5"><a href="it.asp">Web Design</a> </font> </li>
</ul>
<p align="center"></p>
<p align="left">contact the webmaster at green relations dawt com</p>
<p align="center"></p>
<p align="center"></p>

<p><% Response.Write (counter & " Visitors since the last reboot. Your IP address is " & strRemoteIP)%>
(c) 2006 Green Relations Group,. All Rights Reserved.</p>

</body>
</html>

 




Answer this question

Now what do I do?

  • Malagant

    You can use the SMO object model to connect to SQL Server.

  • Now what do I do?