37
Use data from SQLServer: ASPX record sets
l<%@ Page language="VB" debug="true" aspcompat="true" %>
l<%
lConst adOpenStatic = 3
lDIM nStart AS Long,i AS Integer,j AS Long,k AS Long,cNotes AS String
lDIM oField AS Object
lnStart=TIMER
lResponse.Write("Start "+CSTR(NOW())+"<br>")
lDIM oConn = Server.CreateObject("ADODB.Connection")
loConn.Open("DRIVER={SQL Server};SERVER=(local);DATABASE=test;UID=user;Password=pass;")
lDIM oRS = Server.CreateObject("ADODB.Recordset")
loRS.Open("SELECT _ID,Appointment_Notes FROM Visit_",oConn) ',adOpenStatic)
lResponse.Write(oRS.RecordCount)
lj=0
lk=0
lDO WHILE NOT oRS.EOF
l  j=j+oRS("_ID").Value
l  oField=oRS("Appointment_Notes")
l  IF oField.ActualSize>0
l    cNotes=oField.Value
l    k=k+LEN(cNotes)
l  END IF
l  oRS.MoveNext
lLOOP
lResponse.Write("Done "+CSTR(TIMER-nStart)+" "+CSTR(j)+" "+CSTR(k)+"<br>")
l%>
l
lOn 850 MHz PIII: 4.2 seconds, 26 seconds if adOpenStatic parameter is included (to be able to
lcount rows and navigate back and forth in the record set).