<% ' From adovbs.inc: Const adOpenKeyset = 1 Const adLockPessimistic = 2 Const adCmdText = &H0001 ' Local variables Dim strFilename Dim strSQL Dim rsCounter Dim iCount ' Get filename and build SQL query strSQL = "SELECT * FROM hit_count;" ' Open our recordset Set rsCounter = Server.CreateObject("ADODB.Recordset") ' Access version: rsCounter.Open strSQL, _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("bpstats/counter_db.mdb") & ";", _ adOpenKeyset, adLockPessimistic, adCmdText ' SQL Server version: 'rsCounter.Open strSQL, "Provider=SQLOLEDB;Data Source=10.2.1.214;" _ ' & "Initial Catalog=samples;User Id=samples;Password=password;" _ ' & "Connect Timeout=15;Network Library=dbmssocn;", _ ' adOpenKeyset, adLockPessimistic, adCmdText ' If we've got a record then we read the current value ' If we don't then we create one, set the filename, and start at 0 Dim total_count Dim total_count_date Dim running_count Dim running_count_date total_count = rsCounter.Fields("total_count").Value running_count = rsCounter.Fields("running_count").Value total_count = total_count + 1 running_count = running_count + 1 rsCounter.Fields("total_count").Value = total_count rsCounter.Fields("running_count").Value = running_count rsCounter.Update ' Close our connection rsCounter.Close Set rsCounter = Nothing %> Building Concepts Home