473,500 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on Dynamic Array/Nested Loop approach

Hello,

I have the following code which populates as table data from a SQL
Server 2000 stored proc (RSByDemoID2). Below that is the view and
stored procedure which takes @DemoID as input to match to the
event_id. For Q? and Comments I am viewing/updating in a different
table than I am question and how_to_answer. The stored proc is
populated by a view that I'm using to get all these values from two
tables. My quandry is, I am getting the question and how_to_answer
records fine, but can only get Q1, because in that table the Q1 - Q10
and Q11_Text(which is Comments) is stored in one row per event_id. So,
should I use a nested loop to get these values out or do it in memory
in the ASP, perhaps using the Display Order matched against the Q1,
Q2, etc. In either case, could someone show me an example of how I
would do this. I would really appreciate a push in the right
direction. Thanks in advance, John.

ASP code:
<table border=1>
<tr>
<td><font face="Verdana, Arial, Helvetica"
size="1">Question</font></td>
<td><font face="Verdana, Arial, Helvetica" size="1">How to
Answer</font></td>
<td><font face="Verdana, Arial, Helvetica" size="1">Answer</font></td>
<td><font face="Verdana, Arial, Helvetica"
size="1">Comments</font></td>
</tr>

<%
questionCount = 0
Do While Not RSByDemoID2.Eof
questionCount = questionCount + 1
displayOrder = displayOrder
question = "question" & questionCount
how_to_answer = "how_to_answer" & questionCount
Q1 = "Q1" & questionCount
Q2 = "Q2" & questionCount
Q3 = "Q3" & questionCount
Q4 = "Q4" & questionCount
Q5 = "Q5" & questionCount
Q6 = "Q6" & questionCount
Q7 = "Q7" & questionCount
Q8 = "Q8" & questionCount
Q9 = "Q9" & questionCount
Q10 = "Q10" & questionCount
Q11_Text = "Comments" & questionCount
eventId = "event_id" & questionCount
%>
<!-- BEGIN QUESTIONS -->
<tr>
<input type="hidden" name="<%=eventId%>"
value="<%=RSByDemoID2("event_id")%>" >
<td><font face="Verdana, Arial, Helvetica"
size="1"><%=questionCount%>.&nbsp;<%=RSByDemoID2(" question")%></font></td>
<%
If Session("legalQ1") = True Then
Response.Write("<font color=""red"">(Answer to Question 1 must be
numeric)</font>")
End If
%>
<td><font face="Verdana, Arial, Helvetica" size="1"><input
type="text" size="35" name="<%=how_to_answer%>"
value="<%=RSByDemoID2("how_to_answer")%>" ></font></td>

<!-- BEGIN ARRAY (IPO HASHTABLE) FOR THE Q1 - Q11_Text. Match Q1 -
Q11_Text to "Display Order" -->
<!-- Maybe use Nested Loop -->
<td><font face="Verdana, Arial, Helvetica" size="1"><input
type="text" size="2" name="<%=Q?%>" value="<%=RSByDemoID2("Q?")%>"
</font></td>

<td><font face="Verdana, Arial, Helvetica" size="1"><input
type="text" size="20" name="<%=Comments%>"
value="<%=RSByDemoID2("Comments")%>" > </font></td>
<!-- END ARRAY OR NESTED LOOP FOR THE Q1 - Q11_Text -->
</tr>
<!-- END QUESTIONS -->

<%
RSByDemoID2.MoveNext
Loop
VIEW code:
CREATE VIEW dbo.ELRWebComputerLinkView
AS
SELECT
cl.event_id,
vq.version_question_id,
vq.display_order,
vq.question,
vq.how_to_answer,
cl.Q1,
cl.Q2,
cl.Q3,
cl.Q4,
cl.Q5,
cl.Q6,
cl.Q7,
cl.Q8,
cl.Q9,
cl.Q10,
cl.Q11_Text AS Comments

FROM
tblComputerLink cl,
Events e,
VersionQuestions vq

WHERE
e.version_id = vq.version_id and
cl.event_id = e.event_number and cl.resource = 0
Stored Proc code:
CREATE procedure spELRGetComputerLinkDataByDemoID @DemoID as
nvarchar(255)
as
select * from ELRWebComputerLinkView where event_id = @DemoID
GO
Jul 19 '05 #1
0 4332

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2231
by: Bart Nessux | last post by:
How is this done in php? I've tried several variations of the following: contact_array = ($_POST, $_POST, $_POST, $_POST, $_POST); The ultimate goal is to insert the array into a table in...
7
2004
by: Alex Hopson | last post by:
Hi, I've got a multidimensional array and I can loop through it fine but I can't get the values of first parts of the array - ie: foreach ($a as $v1) { foreach ($v1 as $v2) { echo "$v2\n";...
25
12662
by: chad | last post by:
I am writing a program to do some reliability calculations that require several nested for-loops. However, I believe that as the models become more complex, the number of required for-loops will...
3
10418
by: Mark A Framness | last post by:
Greetings, I am working on a project and we need to write a conversion script to initialize a new field on a table. The number of records on this table is on the order of millions so routine...
3
3037
by: pertheli | last post by:
Hello, I have a large array of pointer to some object. I have to run test such that every possible pair in the array is tested. eg. if A,B,C,D are items of the array, possible pairs are AB, AC,...
35
2679
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
9
2007
by: me | last post by:
Hi All, I am new to Classes and learniing the ropes with VB.NET express Here's my question - say I have a want to manage a list of books. Each book has an Author, Title and ISBN Now, I am...
4
1420
by: IanONet | last post by:
I had a need for a two dimentional array. Looking for this solution, I ran accross a statement than all Javascipt arrays were arrays of objects. So I created a function prototype, at least thats...
2
7033
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.