[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Capture into string variables

Posted on 2012-09-18
7
Medium Priority
?
378 Views
Last Modified: 2012-09-19
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
0
Comment
Question by:TCCIRM
  • 4
  • 3
7 Comments
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 38409718
are you using the array anywhere else on the page? if not, why not just loop through the recordset and assign the values to variables?

I guess I'm not really sure what you're trying to accomplish here...
0
 

Author Comment

by:TCCIRM
ID: 38409754
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....
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 38409802
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 :)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:TCCIRM
ID: 38409829
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
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 38410915
is the sql in the attachment the only sql being used here?
0
 

Author Comment

by:TCCIRM
ID: 38413138
That's correct.  Only two recordsets at work here.  rsOther and rsYearCount2.
0
 

Author Comment

by:TCCIRM
ID: 38413376
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....
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Loops Section Overview

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question