Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

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
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
10 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 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