<%option explicit%> <% '************************************************************* ' shows map of states and summarizes APA participation ' uses table statelaws '************************************************************ Dim state dim ussenateALL,ussenateAPA,ushouseALL,ushouseAPA dim govALL,govAPA,stsenateALL,stsenateAPA dim sthouseALL,sthouseAPA,tohALL,tohAPA,serveSHD,serveARE dim percentAPA,statename,popALL,popAPA,wouldbe dim instate dim displaystate dim leadin dim theirshare dim yourstate dim source Dim dbc dim sAction ' displaystate="APA LEADERS IN YOUR STATE" leadin="Are Asian Americans participating as political leaders in your state?" theirshare="their share" yourstate="your state" source="2000 U.S. Census data" state=Request("State") If state = "" Then DisplayForm Else GetFormFields ValidateFormFields if SError="" then ReadDatabase end if DisplayForm end if Sub DisplayForm() %> <% End Sub Sub Readdatabase GenerateSQL on error resume next ShopOpendatabase dbc Set objrs=dbc.execute(Sql) if err.number>0 then sError="Could not open database
" & sql exit sub end if If Not objRs.eof then GetDatabaseFields FormatTextFields else ussenateALL="N/A" ussenateAPA="N/A" ushouseALL="N/A" ushouseAPA="N/A" govALL="N/A" govAPA="N/A" stsenateALL="N/A" stsenateAPA="N/A" sthouseALL="N/A" sthouseAPA="N/A" tohALL="N/A" tohAPA="N/A" serveSHD="N/A" serveARE="N/A" percentAPA="N/A" statename="N/A" popALL="N/A" popAPA="N/A" wouldbe="N/A"="record not found for " & state end if objrs.close set objrs=nothing shopclosedatabase dbc end Sub ' Sub GenerateSql SQl="select * from statelaws where " sql=sql & "state='" & state & "'" 'debugwrite sql end sub Sub GetDatabaseFields ussenateALL = objRS("ussenateALL") ussenateAPA = objRS("ussenateAPA") ushouseALL = objRS("ushouseALL") ushouseAPA = objRS("ushouseAPA") govALL = objRS("govALL") govAPA = objRS("govAPA") stsenateALL = objRS("stsenateALL") stsenateAPA = objRS("stsenateAPA") sthouseALL = objRS("sthouseALL") sthouseAPA = objRS("sthouseAPA") tohALL = objRS("tohALL") tohAPA = objRS("tohAPA") serveSHD = objRS("serveSHD") serveARE = objRS("serveARE") percentAPA = objRS("percentAPA") statename = objRS("statename") popALL = objRS("popALL") popAPA = objRS("popAPA") wouldbe = objRS("wouldbe") end sub ' Sub FormatTextFields Session("ussenateALL")=ussenateALL Session("ussenateAPA")=ussenateAPA Session("ushouseALL")=ushouseALL Session("ushouseAPA")=ushouseAPA Session("govALL")=govALL Session("govAPA")=govAPA Session("stsenateALL")=stsenateALL Session("stsenateAPA")=stsenateAPA Session("sthouseALL")=sthouseALL Session("sthouseAPA")=sthouseAPA Session("tohALL")=tohALL Session("tohAPA")=tohAPA Session("serveSHD")=serveSHD Session("serveARE")=serveARE Session("percentAPA")=percentAPA Session("statename")=statename Session("popALL")=popALL Session("popAPA")=popAPA Session("wouldbe")=wouldbe Session("State")=displaystate leadin="Asian Americans are " & percentAPA & "% of the total population of " & statename & "." TheirShare=percentAPA & "%" YourState=statename Source="2000 U.S. Census data reports " & popAPA & " persons in " & statename & " who identify themselves as Asian " Source=Source & "American (either exclusively or in combination with other races) out of a total population of " Source=Source & popALL & ". This comes to " & percentAPA & "%. If " & percentAPA & " percent of " & statename Source=Source & " federal and state officials were Asian Americans, there would be " & wouldbe & " Asian American officials." end sub ' Sub GetFormFields state=request("State") End sub Sub ValidateFormFields DisplayState="" if State="" then serror=sError & "State" & "
" end if If Serror<>"" then Serror="Please select the following
" & serror end if 'debugwrite "state=" & state & "sex= " & sex & "age= " & age & " race= " & race if Serror="" then GetDisplayState end if end sub ' Sub GetDisplayState dim teststate ' What is good for programming is not good for humans Displaystate=ucase(state) teststate=displaystate Select Case TestState case "DISTRICTOFCOLUMBIA" displaystate="DISTR. of COLUMBIA" case "NORTHDAKOTA" displaystate="NORTH DAKOTA" case "SOUTHDAKOTA" displaystate="SOUTH DAKOTA" case "NEWMEXICO" displaystate="NEW MEXICO" case "RHODEISLAND" displaystate="RHODE ISLAND" case "NEWHAMPSHIRE" displaystate="NEW HAMPSHIRE" case "NEWYORK" displaystate="NEW YORK" case "NEWJERSEY" displaystate="NEW JERSEY" case "WESTVIRGINIA" displaystate="WEST VIRGINIA" case "NORTHCAROLINA" displaystate="NORTH CAROLINA" case "SOUTHCAROLINA" displaystate="SOUTH CAROLINA" end Select end sub %>