Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I assign an ID number to a section of code so that it pulls the appropriate details into the radio list?

Posted on 2004-08-31
10
Medium Priority
?
176 Views
Last Modified: 2010-04-23
The following code pulls a question and assigns it to a label 'lblQ1'

Then ObjCommand.ExecuteReader() pulls in question options from a datasource and assigns them to a radiolist.

lblQ1.Text=(ObjCommand.Parameters("@ReturnQuestion1").Value)

How can I assign an ID number to this section of code so that it pulls the appropriate details into the radio list?
You see, I have a few radiolists one after the other.

Basically, I am trying to pull the appropriate options for each question. At the moment its not matching up the questions with answers.

Sorry, its a difficult problem to explain ....hope this makes some sense.

      RadFSAQ1.DataSource=ObjCommand.ExecuteReader()
      RadFSAQ1.DataTextField="AnswerDescription"
      RadFSAQ1.DataBind()
      objConnection.Close()

Cheers

PG

0
Comment
Question by:pgilfeather
  • 4
  • 3
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11941968
What is the SQL for filling the radio button list?

Bob
0
 

Author Comment

by:pgilfeather
ID: 11941992
@QuestionID1 Int,
@QuestionID2 Int,
@QuestionID3 Int,
@QuestionID4 Int,
@QuestionID5 Int,
@QuestionID6 Int,
@QuestionID7 Int,
@QuestionID8 Int,
@QuestionID9 Int,
@QuestionID10 Int,
@QuestionID11 Int,
@QuestionID12 Int,
@QuestionID13 Int,
@QuestionID14 Int,
@QuestionID15 Int,
@QuestionID16 Int,
@QuestionID17 Int,
@QuestionID18 Int,
@QuestionID19 Int,
@QuestionID20 Int,
@ReturnQuestion1 varchar(8000)OUT,
@ReturnQuestion2 varchar(8000)OUT,
@ReturnQuestion3 varchar(8000)OUT,
@ReturnQuestion4 varchar(8000)OUT,
@ReturnQuestion5 varchar(8000)OUT,
@ReturnQuestion6 varchar(8000)OUT,
@ReturnQuestion7 varchar(8000)OUT,
@ReturnQuestion8 varchar(8000)OUT,
@ReturnQuestion9 varchar(8000)OUT,
@ReturnQuestion10 varchar(8000)OUT,
@ReturnQuestion11 varchar(8000)OUT,
@ReturnQuestion12 varchar(8000)OUT,
@ReturnQuestion13 varchar(8000)OUT,
@ReturnQuestion14 varchar(8000)OUT,
@ReturnQuestion15 varchar(8000)OUT,
@ReturnQuestion16 varchar(8000)OUT,
@ReturnQuestion17 varchar(8000)OUT,
@ReturnQuestion18 varchar(8000)OUT,
@ReturnQuestion19 varchar(8000)OUT,
@ReturnQuestion20 varchar(8000)OUT
AS
BEGIN
SET @ReturnQuestion1 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID1 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID1 = QuestionID
END

BEGIN
SET @ReturnQuestion2 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID2 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID2 = QuestionID
END

BEGIN
SET @ReturnQuestion3 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID3 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID3 = QuestionID
END

BEGIN
SET @ReturnQuestion4 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID4 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID4 = QuestionID
END

BEGIN
SET @ReturnQuestion5 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID5 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID5 = QuestionID
END

BEGIN
SET @ReturnQuestion6 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID6 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID6 = QuestionID
END

BEGIN
SET @ReturnQuestion7 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID7 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID7 = QuestionID
END

BEGIN
SET @ReturnQuestion8 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID8 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID8 = QuestionID
END

BEGIN
SET @ReturnQuestion9 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID9 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID9 = QuestionID
END

BEGIN
SET @ReturnQuestion10 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID10 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID10 = QuestionID
END

BEGIN
SET @ReturnQuestion11 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID11 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID11 = QuestionID
END

BEGIN
SET @ReturnQuestion12 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID12 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID12 = QuestionID
END

BEGIN
SET @ReturnQuestion13 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID13 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID13 = QuestionID
END

BEGIN
SET @ReturnQuestion14 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID14 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID14 = QuestionID
END

BEGIN
SET @ReturnQuestion15 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID15 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID15 = QuestionID
END

BEGIN
SET @ReturnQuestion16 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID16 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID16 = QuestionID
END

BEGIN
SET @ReturnQuestion17 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID17 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID17 = QuestionID
END

BEGIN
SET @ReturnQuestion18 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID18 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID18 = QuestionID
END

BEGIN
SET @ReturnQuestion19 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID19 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID19 = QuestionID
END

BEGIN
SET @ReturnQuestion20 = (SELECT Question
                  FROM dbo.tblFSAQuestions
                  WHERE @QuestionID20 = QuestionID)

SELECT AnswerDescription
FROM dbo.tblFSAPossibleAnswers
WHERE @QuestionID20 = QuestionID
END
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11942011
Could you explain what you are trying to with this?  There are a lot of better ways to accomplish this.  What you have shown is very static, and adding new questions, would only make this more and more complicated.

Bob
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pgilfeather
ID: 11942671
Right,
here goes.

I have a quiz that randomly pulls questions from a datasource via the QuestionID number.

The ID Numbers are pulled into an array before being fed into the parameters that pull the data.

I want to pull 20 Questions onto a web page via these array id numbers but at the moment the questions are not matching up with the multichoice options.

Hope this helps

Regards

PG

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11942695
Are the questions and the options in separate tables?  How are they related?

Bob
0
 

Author Comment

by:pgilfeather
ID: 11942807
They are in separate tables linked by the QuestionID

The columns I want to pull are

Question (from table 1)-----Which sets the question

QuestionOptions(from table 2) ----Which sets the multichoice options

0
 

Author Comment

by:pgilfeather
ID: 11942828
1Question = many QuestionOptions

so 1 to many relationship
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 2000 total points
ID: 11943030
use a dataadapter to fill two tables in a dataset then setup the relation between the two on the question id ... then you can just use GetChildRows() to get the multiple choice answers for a given question ...

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

804 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