related sites: <FREE Help> <ASP> <Asp.net> <worldwide> feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>
ASPTimer VB Component by Sonny Yu sonny@granitetv.com with help from Juan Llibre j.llibre@codetel.net.do
This is a very simple component written in Visual Basic. You can create it by making a new "Active-X DLL" project
Here is the Visual Basic source code for the component: Private Declare Function GetTickCount Lib "kernel32" () As Long Private mvarstime As String Public Property Get stime() As String stime = mvarstime End Property Public Sub profile() mvarstime = CStr(GetTickCount) End Sub
Now it is invoked on an ASP page with the following code: <Test Script Below>
<HTML><HEAD> <TITLE>asptimer.asp by Sunny Yu, Juan Llibre</TITLE> </HEAD><body bgcolor="#FFFFFF"> <% dim obtime dim obtime2 set obtime=server.createobject("Asptimer.AsptimerClass") response.write isobject(obtime) & "<br>" obtime.profile response.write obtime.stime & "<br>" dim cn(100) dim cmd(100) For x = 0 to 100 Set cn(x) = Server.CreateObject("ADODB.Connection") cn(x).Open "DRIVER={SQL Server};SERVER=servername;DATABASE=Pubs;UID=sa" Set cmd(x) = Server.CreateObject("ADODB.Command") cmd(x).activeconnection = cn(x) cmd(x).commandtext = "SELECT * FROM Authors" cmd(x).execute Set cmd(x) = Nothing cn(x).close Next 'set obtime=nothing set obtime2=server.createobject("Asptimer.AsptimerClass") response.write isobject(obtime2) & "<br>" obtime2.profile response.write obtime2.stime & "<br>" response.write obtime2.stime-obtime.stime set obtime2=nothing %> </BODY></HTML>