4 5 Server.ScriptTimeOut = 6000 'Define all varity Dim wagebhConn Dim iepa00hRs Dim found Dim last_pa_no,current_pa_no,next_pa_no found=0 start_time=now() Set wagebhConn=CreateObject("ADODB.Connection") wagebhConn.Open "FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\wagebh.dsn" Set iepa00hRs=CreateObject("ADODB.Recordset") sql="SELECT pa_no,pa_name,pa_indat,dp_no,pa_tino,pa_ssno FROM iepa00h" 'Set iepa00hRs=wagebhConn.Execute(sql,1,1) iepa00hRs.open sql,wagebhConn,adopendynamic WHILE NOT iepa00hRs.EOF if (iepa00hRs.BOF) then last_rd=0 current_rd=cint(iepa00hRs("pa_no")) iepa00hRs.MoveNext last_rd=cint(iepa00hRs("pa_no")) else iepa00hRs.MoveNext iepa00hRs.MoveFirst iepa00hRs.MovePrevious last_rd=cint(iepa00hRs("pa_no")) iepa00hRs.MoveNext current_rd=cint(iepa00hRs("pa_no")) iepa00hRs.MoveNext next_rd=cint(iepa00hRs("pa_no")) if (current_rd+current_rd=last_rd+next_rd) then iepa00hRs.MovePrevious found=found+1 end if END IF iepa00hRs.MoveNext WEND iepa00hRs.Close wagebhConn.Close 1