Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting rows from stored procedure

Status
Not open for further replies.

klinney

MIS
Apr 27, 2004
5
0
0
GB
I have a stored procedure that runs and outputs results onto an asp page. From there i want to select various rows that interest me via a checkbox and submit the rows to a new page where i can print my results.
I am struggling with getting the rows to display again after the checkboxes have been ticked.
The file that outputs the results the first time looks as follows:

Dim objField
For Each objField in objRSReport.Fields
Response.Write "<td class='ReportHeader'>" & objField.Name & "</td>"
Next
Response.Write "</tr><tr>"
Do While Not objRSReport.EOF
Response.Write "<td class='ReportHeader'>" & x & "</td>"
For each objField in objRSReport.fields
Response.Write "<td class='ReportContent'>" & objField.value & " </td> "
Next
Response.Write "</tr>"
x=x+1
objRSReport.MoveNext
Loop

Can you help please?
 
An easy way to do it is to create an IN CLAUSE on the receiving page. Give all of your check boxes the same name. For the Value of each checkbox use whatever unique ID field you have in your table. Quick example:
Code:
<input type="checkbox" name="chk" value="<%=objField.YourIDColumn.Value%>">

Then on the receiving page:
Code:
myInClause = "(" & request.form("chk") & ")"
strSql = "SELECT * FROM MyTable WHERE myIDColumn IN " & myInClause
 
I am having problems getting a proper value into the checkbox. In the code that follows you can see I get a value of x (row number) into checkbox. How do I get JobID (primary Key)into there. My table is called JobsGlasgow.
I have tried various ways but none seem to work. Obviously am missing something. Please help. Thanks


Do While Not objRSReport.EOF
Response.Write "<td class='ReportHeader'>" & x & "</td>"
Response.Write "<td class='ReportHeader'><input type=checkbox name=C1 value=" & x & "></td>"
For each objField in objRSReport.fields
Response.Write "<td class='ReportContent'>" & objField.value & " </td> "
Next
Response.Write "</tr>"
x=x+1
objRSReport.MoveNext
Loop
 
what is the field name of the primary key?

add it like this


Response.Write "<input type=checkbox name=C1 value=" & objRSReport("myPrimaryKeyName") & "></td>"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top