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
173 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
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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 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