Advertisement

09.26.2005 at 01:23PM PDT, ID: 21574640
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

ASP page query not working

Asked by gamble2003 in Web Languages/Standards

Tags:

Hello, my ASP page which is a query/search function works, but the query info doesn't display:
the two fields in the database are STUDENT_ID AND NAME or I can use another field NAME_SORT - I've tried both.  What am I doing wrong?




<%
'Start processing form data if any
IF Request.QueryString("Process") = "1" THEN

      'Reference the Session connection variable
      Set cn = Session("cnStar")

      'Create a recordset
      Set RequestInfo = Server.CreateObject("ADODB.Recordset")

      'Build a query string
      querystr = "SELECT * FROM UISMaster"
      wherestr = ""
      statusstr = ""

IF (Request.Form("search") = "STUDENT_ID" and Request.Form("SID") <> "") THEN
            wherestr = " WHERE STUDENT_ID LIKE '" & Request.Form("SID") &"%'"
      ELSEIF (Request.Form("search") = "NAME_SORT" and Request.Form("NAMESORT") <> "") THEN
            wherestr = " WHERE NAME_SORT LIKE '" & Request.Form("NAMESORT") &"%'"
      ELSE
            wherestr = " WHERE STUDENT_ID = '123456789'"
      END IF

      IF len(statusstr) >0 THEN
            IF len(wherestr) >0 THEN
                  statusstr = " AND " & statusstr
            ELSE
                  statusstr = " WHERE " & statusstr
            END IF
      END IF

      orderstr = " ORDER BY NAME_SORT"

      querystr = querystr & wherestr & statusstr & orderstr

      'Set all the properties for the recordset
      RequestInfo.ActiveConnection = cn
      RequestInfo.CursorType = adOpenKeyset
      RequestInfo.LockType = adLockOptimistic
      RequestInfo.Source = querystr
      RequestInfo.Open
      %>

      <CENTER>

<H2 align="center">STAR</H2>
<p align="center">Student Tracking And Reporting </p>
      <HR>
      Click the link in the StudentID column to view more detail.
      <HR>

      <TABLE CELLPADDING=3 BORDER=0 COLSPAN=8>
            <%   'Output the table headers

            ' Response.Write querystr

            For i = 0 To 15
                  IF i=0 THEN
                        Response.Write "<TD CLASS=header>StudentID</TD>"
                  ELSEIF (i=3 or i=4 or i=13 or i=14 or i=15) THEN
                        Response.Write "<TD CLASS=header>" & RequestInfo.Fields(i).Name & "</TD>"
                  END IF
            NEXT
            'Loop through the recordset to output the table values
            Do While Not RequestInfo.EOF
                  Response.Write "<TR>"
                  For i = 0 to 15 'Output the field values for the student
                        IF i = 0 THEN
                              Response.Write "<TD ALIGN=center>"
                              Response.Write "<A HREF=""studentprofile.asp?SID="
                              Response.Write RequestInfo.Fields(i).Value
                              Response.Write """>"
                              Response.Write RequestInfo.Fields(i).Value
                              Response.Write "</A></TD>"
                        ELSEIF (i= 3 or i=4 or i = 13 or i = 14 or i = 15) THEN
                              Response.Write "<TD>"
                              Response.Write RequestInfo.Fields(i).Value
                              Response.Write "</TD>"
                        ELSE
                        END IF
                  NEXT
                  Response.Write "</TR>"
                  RequestInfo.MoveNext
            LOOP
            %>

      </TABLE>
      <HR>
      </CENTER>
      <BR>
      Return to the <a href="MainMenu.asp">Main Menu</a>

      </BODY>
      </HTML>


      <% 'Close the recordset after use
      RequestInfo.Close

ELSE 'Output a form so that the user can search
%>


      <CENTER>
      <H2>Find a student</H2>

      <HR>
      To find a student,<BR>
      fill out the following form and then press the button at the bottom of the page.
      </CENTER>

      <FORM NAME="SearchForm" ACTION="findstudent2.asp?Process=1" METHOD=POST>
      <TABLE ALIGN=CENTER CLASS=formtable CELLPADDING=2>
            <TR>
                  <TD>Name (Last, First):</TD>
                  <TD><INPUT TYPE="text" NAME="NAME_SORT" SIZE=40 MAXLENGTH=40></TD>
            </TR>
            <TR>
                  <TD>Student ID:</TD>
                  <TD><INPUT TYPE="text" NAME="SID" SIZE=9 MAXLENGTH=9></TD>
            </TR>
            <TR>
                  <TD>Search:</TD>
                  <TD>
                        <INPUT type="radio" name="search" value="Namesort" checked>Name
                        <INPUT type="radio" name="search" value="SID">SID
                  </TD>
            </TR>
            <TR>
                  <TD></TD>
                  <TD><INPUT TYPE="submit" NAME="SearchButton" VALUE="Search">
                  <INPUT TYPE="reset" NAME="reset" VALUE="Reset"></TD>
            </TR>
      </TABLE>
      </FORM>

      <BR><BR><HR>
      Return to the <a href="MainMenu.asp">Main Menu
      </BODY>
      </HTML>
</a>
<% END IF %>
Start Free Trial
 
 
[+][-]09.26.2005 at 11:58PM PDT, ID: 14964686

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.27.2005 at 02:28AM PDT, ID: 14965159

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.03.2005 at 03:21PM PDT, ID: 15010396

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.21.2005 at 01:04AM PDT, ID: 15130665

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Web Languages/Standards
Tags: first
Sign Up Now!
Solution Provided By: yoongcame
Participating Experts: 3
Solution Grade: B
 
 
[+][-]10.21.2005 at 02:56PM PDT, ID: 15135896

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.24.2005 at 02:23PM PDT, ID: 15150097

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32