I have a problem..
on my ASP page.. I'm randomly selecting some employees .. I randomly pick out 5 employees to be tested..
the problem is.. When i hit the get employee button.. it picks out 5 employees no problem.. but when i go to view report.. It adds in the first record in the database.. making it a total of 6 employees I see on my report.. which there should be only 5.. I been looking back and forth at this code.. but I don't see it..
could someone take a look .. thanks
<%
STRINGvar = Server.MapPath("drugscreen.mdb"
ConnSTRING = "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&STRINGvar
set rsEMPLOYEES = Server.CreateObject("ADODB.Recordset"
rsEMPLOYEES.ActiveConnection = ConnSTRING
Randomize
R=clng(100000*rnd)
rsEMPLOYEES.Source = "SELECT top 5 * FROM tblDupont ORDER BY rnd(-(EmpNumber *" & R & "
)"
' This pulls back 5 records, but you can change that dynamically e.g.
' rsEMPLOYEES.Source = "SELECT top "& no_records &" * FROM tblDupont ORDER BY rnd(-(ID *" & R & "
)"
' Change ID to the ID field name you use in the table
rsEMPLOYEES.CursorType = 0
rsEMPLOYEES.CursorLocation = 2
rsEMPLOYEES.LockType = 3
rsEMPLOYEES.Open()
counter=0
Do
Response.write "<TABLE><TR>"
Response.write "<TH>Payroll Number</TH><TH>Employee Name</TH><TH>Supervisor</TH><TH>Supervisor Ext</TH>"
Response.write "</TR>"
Do
response.write "<TR><TD>" & (rsEMPLOYEES("EmpNumber"
) & "</TD>"
response.write "<TD>" & " - " & (rsEMPLOYEES("EmpName"
) & "</TD>"
response.write "<TD>" & " - " & (rsEMPLOYEES("Supervisor"
) & "</TD>"
response.write "<TD>" & " - " & (rsEMPLOYEES("SupervisorExt"
) & "</TD></TR>"
rsEMPLOYEES("tested"
=Date()
rsEMPLOYEES.update
rsEMPLOYEES.MoveNext
Loop Until rsEMPLOYEES.Eof
Response.write "</TABLE>"
Loop Until rsEMPLOYEES.Eof
rsEMPLOYEES.Close
Set rsEMPLOYEES = nothing
%>
on my ASP page.. I'm randomly selecting some employees .. I randomly pick out 5 employees to be tested..
the problem is.. When i hit the get employee button.. it picks out 5 employees no problem.. but when i go to view report.. It adds in the first record in the database.. making it a total of 6 employees I see on my report.. which there should be only 5.. I been looking back and forth at this code.. but I don't see it..
could someone take a look .. thanks
<%
STRINGvar = Server.MapPath("drugscreen.mdb"
ConnSTRING = "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&STRINGvar
set rsEMPLOYEES = Server.CreateObject("ADODB.Recordset"
rsEMPLOYEES.ActiveConnection = ConnSTRING
Randomize
R=clng(100000*rnd)
rsEMPLOYEES.Source = "SELECT top 5 * FROM tblDupont ORDER BY rnd(-(EmpNumber *" & R & "
' This pulls back 5 records, but you can change that dynamically e.g.
' rsEMPLOYEES.Source = "SELECT top "& no_records &" * FROM tblDupont ORDER BY rnd(-(ID *" & R & "
' Change ID to the ID field name you use in the table
rsEMPLOYEES.CursorType = 0
rsEMPLOYEES.CursorLocation = 2
rsEMPLOYEES.LockType = 3
rsEMPLOYEES.Open()
counter=0
Do
Response.write "<TABLE><TR>"
Response.write "<TH>Payroll Number</TH><TH>Employee Name</TH><TH>Supervisor</TH><TH>Supervisor Ext</TH>"
Response.write "</TR>"
Do
response.write "<TR><TD>" & (rsEMPLOYEES("EmpNumber"
response.write "<TD>" & " - " & (rsEMPLOYEES("EmpName"
response.write "<TD>" & " - " & (rsEMPLOYEES("Supervisor"
response.write "<TD>" & " - " & (rsEMPLOYEES("SupervisorExt"
rsEMPLOYEES("tested"
rsEMPLOYEES.update
rsEMPLOYEES.MoveNext
Loop Until rsEMPLOYEES.Eof
Response.write "</TABLE>"
Loop Until rsEMPLOYEES.Eof
rsEMPLOYEES.Close
Set rsEMPLOYEES = nothing
%>