TCCIRM
asked on
Capture into string variables
I wish to capture the following array into string variables I can use anywhere else on the page rather than simply writing them out as rendered. Years will obvisously increase over time....
rsYearCount2_cmd.CommandTe xt = "SELECT dbo.Workorder.year_id AS Year FROM dbo.Admin INNER JOIN dbo.Workorder ON dbo.Admin.wo_id = dbo.Workorder.wo_id GROUP BY dbo.Workorder.year_id, dbo.Admin.status HAVING (COUNT(*) >= 1) AND (dbo.Admin.status = 'Completed') ORDER BY COUNT(*) DESC"
rsYearCount2_cmd.Prepared = true
Set rsYearCount2 = rsYearCount2_cmd.Execute
arrRecs = rsYearCount2.GetRows
For row = 0 To UBound(arrRecs, 2) 'Rows
For col = 0 To UBound(arrRecs, 1) 'Columns
Response.Write "20" & arrRecs(col, row)
Next
Response.Write "<br />"
Next
rsYearCount2_numRows = 0
rsYearCount2_cmd.CommandTe
rsYearCount2_cmd.Prepared = true
Set rsYearCount2 = rsYearCount2_cmd.Execute
arrRecs = rsYearCount2.GetRows
For row = 0 To UBound(arrRecs, 2) 'Rows
For col = 0 To UBound(arrRecs, 1) 'Columns
Response.Write "20" & arrRecs(col, row)
Next
Response.Write "<br />"
Next
rsYearCount2_numRows = 0
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can you post the code for the loop you're trying to insert this loop into? maybe seeing that will help me understand your end goal
>>> still a novice here
no worries, we all started somewhere :)
>>> still a novice here
no worries, we all started somewhere :)
ASKER
Here's what I am working with. I am trying to create another loop here: <%=(rsOther.Fields.Item("2 011").Valu e)%> Replacing the hard coded year values with the values from rsYearCount2..... Attached is the SQL Statement for rsOther.
<%
While ((Repeat4__numRows <> 0) AND (NOT rsOther.EOF))
%>
<tr align="center">
<td align="left"><% If (rsOther.Fields.Item("orga n").Value) <> "Other" Then %> <%=(rsOther.Fields.Item("o rgan").Val ue) %> <% Else %> <%= (rsOther.Fields.Item("othe r").Value) %> <% End If %></td>
<td ><%=(rsOther.Fields.Item(" 2011").Val ue)%></td> 'This is where I need another loop
<td ><%=(rsOther.Fields.Item(" 2012").Val ue)%></td>
</tr>
<%
Repeat4__index=Repeat4__in dex+1
Repeat4__numRows=Repeat4__ numRows-1
rsOther.MoveNext()
Wend
%>
Other-sql.txt
<%
While ((Repeat4__numRows <> 0) AND (NOT rsOther.EOF))
%>
<tr align="center">
<td align="left"><% If (rsOther.Fields.Item("orga
<td ><%=(rsOther.Fields.Item("
<td ><%=(rsOther.Fields.Item("
</tr>
<%
Repeat4__index=Repeat4__in
Repeat4__numRows=Repeat4__
rsOther.MoveNext()
Wend
%>
Other-sql.txt
is the sql in the attachment the only sql being used here?
ASKER
That's correct. Only two recordsets at work here. rsOther and rsYearCount2.
ASKER
I think my original statement "Maybe I'm going about this all wrong...." is correct. I am now going in a different direction for the solution. Thanks for the response....
ASKER