I have a recordset that I am displaying via an ASP. On the web page each record has a textbox next to it, so the user can enter a number for the amount of times that record will need to be displayed for printing. How can I develop a method to loop through each record and display that record based on the number entered in the textbox?
-Gabe
-Gabe
Code:
<%
'Declare our variables... always a good thing!
Dim cnnSimple 'ADO connection
Dim rstSimple 'ADO recordset
Dim strDBPath 'path to our Access database (*.mdb) file
'Mappath of virtual database file
strDBPath = Server.MapPath("database.mdb")
'Create an ADO connection to connect to the search database
Set cnnSimple = Server.CreateObject("ADODB.Connection")
'This line is for the Access database
cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
'Execute a query using the connection object
Set rstSimple = cnnSimple.Execute("SELECT * FROM labels")
%>
<form action="print.asp" method="post">
<table border="1">
<tr>
<th bgcolor="#3D80C2">id</th>
<th bgcolor="#3D80C2">Location</th>
<th bgcolor="#3D80C2">Nomenclature</th>
<th bgcolor="#3D80C2">NSN</th>
<th bgcolor="#3D80C2">U/P</th>
<th bgcolor="#3D80C2">Qty</th>
</tr>
<%
Do While Not rstSimple.EOF
%>
<tr>
<td bgcolor="#FFCC00"><%= rstSimple.Fields("id").Value %> </td>
<td bgcolor="#FFCC00"><%= rstSimple.Fields("bin").Value %> </td>
<td bgcolor="#FFCC00"><%= rstSimple.Fields("nomen").Value %> </td>
<td bgcolor="#FFCC00"><%= rstSimple.Fields("nsn").Value %> </td>
<td bgcolor="#FFCC00"><%= rstSimple.Fields("sell").Value %> </td>
<td bgcolor="#FFCC00"><p align="center"><input type="text" name="Labelcnt" value="1" size="2"></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<input type="submit" value="Submit">
</form>
<%
' Close our recordset and connection and dispose of the objects
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing
%>
Comment