36
Use data from SQLServer: ASP
l<%
lConst adOpenStatic = 3
lDIM nStart,oConn,oRS,i,j,k,cNotes,oField
lnStart=TIMER
lResponse.Write("Start "+CSTR(NOW())+"<br>")
lSET oConn = Server.CreateObject("ADODB.Connection")
loConn.Open "DRIVER={SQL Server};SERVER=(local);"+ _
l  "DATABASE=test;UID=user;Password=pass;"
lSET oRS = Server.CreateObject("ADODB.Recordset")
loRS.Open "SELECT _ID,Appointment_Notes FROM Visit_",oConn ',adOpenStatic
lj=0
lk=0
lDO WHILE NOT oRS.EOF
l  j=j+oRS("_ID").Value
l  cNotes=oRS("Appointment_Notes").Value
l  IF NOT ISNULL(cNotes) THEN
l    k=k+LEN(cNotes)
l  END IF
l  IF NOT ISNULL(cString) THEN k=k+LEN(cString)
l  oRS.MoveNext
lLOOP
lResponse.Write("Done "+CSTR(TIMER-nStart)+" "+CSTR(j)+" "+CSTR(k)+"<br>")
l%>
l
lOn 850 MHz PIII: 2.2 seconds, 26 seconds if adOpenStatic parameter is included (to be able to
lcount rows and navigate back and forth in the record set).
l