Display one record at a time!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Display one record at a time!

  1. #1
    ASP learner Guest

    Display one record at a time!


    Hi, Fellow developers:

    I have a total of 20 questions that I need to ask a user (kind of a survey
    question). If the user responds YES to a question I take them to question
    # 3 and if the user answers no then I ask them another set of sub questions
    and then take them to question # 2. If they answer question # 2 as yes then
    I take them to question # 4 (skipping # 3 question).

    Also as they answer I need to I need to capture data in the database. I created
    the recordset and displayed all the questions but I only need to display
    one question at a time and based on their responses.

    Thanks,




  2. #2
    Q*bert Guest

    Re: Display one record at a time!


    No Code, just logic.

    Have a seperate table in the database that shows your assocaiates
    Eg.

    tblQuestionLookukp
    QuestionID ResponseID NextQuestionID
    1 YES 3
    1 NO 2
    .....

    After each question is submitted, evaluate the answer and display the next
    question.

    Sounds simple enough. In all
    You should have 2 pages.
    1) DisplayQuestion
    2) StoreAnswer
    3) EndPage

    1) Display question gets the first question to display and the available
    answers unless passed a question number, if passed a question number it displays
    that question and answers

    2) Store answer saves the response for the question on the calling page and
    retreives the next question based on the answer to the previous page question,
    then redirects to displayQuestion passing the question to display. If no
    more questions, display end page

    3) End page, thank user for answering questions. and do whatever else needs
    to be done.

    "ASP learner" <Aamir.Khan@CITIZENSBANK.com> wrote:
    >
    >Hi, Fellow developers:
    >
    >I have a total of 20 questions that I need to ask a user (kind of a survey
    >question). If the user responds YES to a question I take them to question
    ># 3 and if the user answers no then I ask them another set of sub questions
    >and then take them to question # 2. If they answer question # 2 as yes then
    >I take them to question # 4 (skipping # 3 question).
    >
    >Also as they answer I need to I need to capture data in the database. I

    created
    >the recordset and displayed all the questions but I only need to display
    >one question at a time and based on their responses.
    >
    >Thanks,
    >
    >
    >



  3. #3
    Jake Duckworth Guest

    Re: Display one record at a time!


    Hi,

    I have found a couple of web site that offers that kind of functionality
    for a reasonable price...

    http://www.keysurvey.com
    http://www.online-survey.com/

    My company opted to purchase their service instead of taking the time to
    develop it themselves.




    "ASP learner" <Aamir.Khan@CITIZENSBANK.com> wrote:
    >
    >Hi, Fellow developers:
    >
    >I have a total of 20 questions that I need to ask a user (kind of a survey
    >question). If the user responds YES to a question I take them to question
    ># 3 and if the user answers no then I ask them another set of sub questions
    >and then take them to question # 2. If they answer question # 2 as yes then
    >I take them to question # 4 (skipping # 3 question).
    >
    >Also as they answer I need to I need to capture data in the database. I

    created
    >the recordset and displayed all the questions but I only need to display
    >one question at a time and based on their responses.
    >
    >Thanks,
    >
    >
    >



  4. #4
    ASP learner Guest

    Re: Display one record at a time!


    Sorry for not providing the code. But the code is very genric. I have questions
    in Access database and using objConn and objRec objects connecting to it
    and generating a recordset. Following is the code and all I want to do is
    display one question (1st record) and insert the answer into the database.
    If the answer to a question is "NO" then display a set of "Sub Questions"

    <HTML>
    <HEAD>
    <TITLE>Question 1</TITLE>
    </HEAD>


    <BODY>


    <FORM action="Validate1.asp" method=get>

    <!-- #INCLUDE FILE= "db.asp" -->

    <CENTER>
    <TABLE border="2" width="80%">
    <TR><TD><CENTER><H3>Question Number</H3></CENTER></TD><TD><CENTER><H3>Question</H3></CENTER></TD></TR>

    <% Rec.Open "SELECT * FROM adQuestions"%>
    <% Dim Question%>
    <% Do Until Rec.EOF%><TR>
    <% For Each Question In Rec.Fields %>
    <TD><% Response.Write(Question.Value) %></TD>
    <% Next%>
    <% Rec.MoveNext%>
    <% Loop%></TR>
    </TABLE><BR>
    <!-- #INCLUDE FILE= "SubmitReset.asp" -->
    </CENTER>

    </FORM>
    <%Rec.Close%>
    <%Conn.Close%>

    </BODY>
    </HTML>



  5. #5
    Q*bert Guest

    Re: Display one record at a time!


    Actually my statement was that I was giving just the logic, no code.

    From the stand point of your code, you need to pass a where clause to limit
    your result set such as question number. The whole select * from questions
    is what is giving you your entire question list.

    Try select * from adquestions where questionID = Variable.

    the variable represents the question your needing to have answered.

    I thought I covered most of this in the original post...

    It also looks like the question itself contains all the HTML code for generating
    the question including the possible list of answers. Not sure If Id go that
    route.

    Sorry if these didn't help

    Q*bert
    @!#(*$&

    "ASP learner" <Aamir.Khan@CITIZENSBANK.com> wrote:
    >
    >Sorry for not providing the code. But the code is very genric. I have questions
    >in Access database and using objConn and objRec objects connecting to it
    >and generating a recordset. Following is the code and all I want to do is
    >display one question (1st record) and insert the answer into the database.
    >If the answer to a question is "NO" then display a set of "Sub Questions"
    >
    ><HTML>
    ><HEAD>
    ><TITLE>Question 1</TITLE>
    ></HEAD>
    >
    >
    ><BODY>
    >
    >
    ><FORM action="Validate1.asp" method=get>
    >
    ><!-- #INCLUDE FILE= "db.asp" -->
    >
    ><CENTER>
    ><TABLE border="2" width="80%">
    > <TR><TD><CENTER><H3>Question Number</H3></CENTER></TD><TD><CENTER><H3>Question</H3></CENTER></TD></TR>
    >
    > <% Rec.Open "SELECT * FROM adQuestions"%>
    > <% Dim Question%>
    > <% Do Until Rec.EOF%><TR>
    > <% For Each Question In Rec.Fields %>
    > <TD><% Response.Write(Question.Value) %></TD>
    > <% Next%>
    > <% Rec.MoveNext%>
    > <% Loop%></TR>
    ></TABLE><BR>
    ><!-- #INCLUDE FILE= "SubmitReset.asp" -->
    ></CENTER>
    >
    ></FORM>
    > <%Rec.Close%>
    > <%Conn.Close%>
    >
    ></BODY>
    ></HTML>
    >
    >



  6. #6
    ASP Learner Guest

    Re: Display one record at a time!


    Thanks a bunch that helps a lot!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center