creating a variable from a request.Querystring

Posted on 2003-03-06
Medium Priority
Last Modified: 2012-05-04
The below is some code I have created- it swaps Grade to Math_bonus and displays the correct Math_bonus value for the entered Grade. I now want to expand on this and take points_awarded the outcome of the above, and check is it greater then values in multiple fields of multiple tables. I like to make points_awarded a variable for easy access, without messing up the code

<form action="test2.asp" method="get"><%
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "db2"

Set objRS = Server.CreateObject("ADODB.Recordset")

SQL = "Select Grade, Math_bonus From point_grade"
Set objRS = Con.Execute(SQL)

If Not objRS.EOF Then
                      <select name="Points_awarded" onchange="form.submit()">
          Do While Not objRS.EOF
                        <option value="<%=objRS.Fields("Math_bonus")%>"><%=objRS.Fields("Grade") %></option>
                      <%= request.Querystring("Points_awarded")%> </p>
                    <p>&nbsp; </p>
          End If    
Question by:tmd200
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
1 Comment

Accepted Solution

memerot earned 120 total points
ID: 8080236
At the beginning of your page just put
Dim intPoints
intPoints = Request.QueryString("Points_awarded")

It doesn't have to go at the top, but it's more useful there in case you find you need the variable at other places throughout your page.  But if you only access the value once, it's not really worth putting in a variable.  If you access it twice or more, then it's recommended.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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