View Single Post
  #3 (permalink)  
Old April 29th, 2008, 07:36 AM
MarkGT MarkGT is offline
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, here is the code

Code:
<%@ Language = VBscript %>
<% Option Explicit %>

<% Response.Buffer = True %>


<html>
<head>

<SCRIPT language=JavaScript>

function reload(form){
var val=form.xclass.options[form.xclass.options.selectedIndex].value;
self.location='mll.asp?xclass=' + val ;
}

function areload(form){
var aval=form.axclass.options[form.axclass.options.selectedIndex].value;
self.location='mll.asp?axclass=' + aval ;
}

function breload(form){
var bval=form.bxclass.options[form.bxclass.options.selectedIndex].value;
self.location='mll.asp?bxclass=' + bval ;
}

</script>
</head>
<body>
The idea behind this is to allow the user to be able to select three different classes<br>
and then click a "submit" button to run hardcoded sql statements to compare statistics<br> between the three groups. 
<%

'=========================
'first set of ddls
'=========================

Dim objconn,objRS,strSQL,xclass
xclass=Request.QueryString("xclass")
Set objconn = Server.CreateObject("ADODB.Connection")
objconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Series6.mdb")
objconn.Open
Set objRs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT distinct class from s6test"
objRS.Open strSQL, objconn
Response.Write "<form method=post name=f1 action=dll.asp target="_self"><select name=xclass onchange='reload(this.form)'><option value=''>Class</option>"
Do While Not objRS.EOF 
Response.Write "<option value=" & objRs("class") & ">" & objRs("class") & "</option>"
objRS.MoveNext
Loop
objRs.Close
Response.Write "</select>"
Response.Write "&nbsp;&nbsp;"

If len(xclass) > 1 Then
strSQL = "SELECT distinct classmd FROM s6test where class='" & xclass & "';"
objRS.Open strSQL, objconn
Response.write "<select name=select2><option value=''>Month/Day</option>"    
Do While Not objRS.EOF 
Response.Write "<option value=" & objRs("classmd") & ">" & objRs("classmd") & "</option>"
objRS.MoveNext
Loop
Response.Write "</form>"
response.write "</select>"
objRs.Close
objconn.Close
end if
Response.write "<br><br>" 

'====================
'second set of ddls
'====================

Dim aobjconn,aobjRS,astrSQL,axclass
axclass=Request.QueryString("axclass")
Set aobjconn = Server.CreateObject("ADODB.Connection")
aobjconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Series6.mdb")
aobjconn.Open
Set aobjRs = Server.CreateObject("ADODB.Recordset")
astrSQL = "SELECT distinct class from s6test"
aobjRS.Open astrSQL, aobjconn
Response.Write "<form method=post name=f2 action=''><select name=axclass onchange='areload(this.form)'><option value=''>Class</option>"
Do While Not aobjRS.EOF 
Response.Write "<option value=" & aobjRs("class") & ">" & aobjRs("class") & "</option>"
aobjRS.MoveNext
Loop
aobjRs.Close
Response.Write "</select>"
Response.Write "&nbsp;&nbsp;"

If len(axclass) > 1 Then
astrSQL = "SELECT distinct classmd FROM s6test where class='" & axclass & "';"
aobjRS.Open astrSQL, aobjconn
Response.write "<select name=select3><option value=''>Month/Day</option>"    
Do While Not aobjRS.EOF 
Response.Write "<option value=" & aobjRs("classmd") & ">" & aobjRs("classmd") & "</option>"
aobjRS.MoveNext
Loop
Response.Write "</form>"
response.write "</select>"
aobjRs.Close
aobjconn.Close
end if 
response.write "<br><br>"

'====================
'Third set of ddls
'====================

Dim bobjconn,bobjRS,bstrSQL,bxclass
bxclass=Request.QueryString("bxclass")
Set bobjconn = Server.CreateObject("ADODB.Connection")
bobjconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Series6.mdb")
bobjconn.Open
Set bobjRs = Server.CreateObject("ADODB.Recordset")
bstrSQL = "SELECT distinct class from s6test"
bobjRS.Open bstrSQL, bobjconn
Response.Write "<form method=post name=f2 action=''><select name=bxclass onchange='breload(this.form)'><option value=''>Class</option>"
Do While Not bobjRS.EOF 
Response.Write "<option value=" & bobjRs("class") & ">" & bobjRs("class") & "</option>"
bobjRS.MoveNext
Loop
bobjRs.Close
Response.Write "</select>"
Response.Write "&nbsp;&nbsp;"

If len(bxclass) > 1 Then
bstrSQL = "SELECT distinct classmd FROM s6test where class='" & bxclass & "';"
bobjRS.Open bstrSQL, bobjconn
Response.write "<select name=select3><option value=''>Month/Day</option>"    
Do While Not bobjRS.EOF 
Response.Write "<option value=" & bobjRs("classmd") & ">" & bobjRs("classmd") & "</option>"
bobjRS.MoveNext
Loop
Response.Write "</form>"
response.write "</select>"
bobjRs.Close
bobjconn.Close
end if 
%>

</body>
</html>
Reply With Quote