Link to home
Start Free TrialLog in
Avatar of TCCIRM
TCCIRMFlag for United States of America

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.CommandText = "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
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TCCIRM

ASKER

I am trying to do exactly that.  Ultimately I need this to display within another loop and have been unsuccessful making that happen, thus I was thinking if I could capture the value(s) up front, I could easily use them within the higher level loop.  Maybe I'm going about this all wrong....   still a novice here....
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 :)
Avatar of TCCIRM

ASKER

Here's what I am working with. I am trying to create another loop here:  <%=(rsOther.Fields.Item("2011").Value)%>  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("organ").Value) <> "Other" Then %> <%=(rsOther.Fields.Item("organ").Value) %> <% Else %> <%= (rsOther.Fields.Item("other").Value) %> <% End If %></td>

<td ><%=(rsOther.Fields.Item("2011").Value)%></td>     'This is where I need another loop
<td ><%=(rsOther.Fields.Item("2012").Value)%></td>
              </tr>
              <%
  Repeat4__index=Repeat4__index+1
  Repeat4__numRows=Repeat4__numRows-1
  rsOther.MoveNext()
Wend
%>
Other-sql.txt
is the sql in the attachment the only sql being used here?
Avatar of TCCIRM

ASKER

That's correct.  Only two recordsets at work here.  rsOther and rsYearCount2.
Avatar of TCCIRM

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....