ITisSpatial
IS-IT--Management
I'm trying to use the results from one recordset. To query the database to establish a second recordset.
I'm brand new to vbscript but have done this many times in PHP. I'm having some trouble with the second recordset
Here's my initial attempts:
''Having connected to the database
''Open the RecordSet
Dim SQL
SQL = "SELECT DISTINCT COUNTYNO,City_FIPS FROM tblALL_ZIP9 WHERE ZIPNINE = " & Zip9 & ""
Dim RecSet
Set RecSet = CreateObject("ADODB.RecordSet")
RecSet.Open SQL, dbconnect
While Not RecSet.EOF
Response.Write(RecSet("COUNTYNO") &"<br>")
RecSet.MoveNext
Wend
''''''Everything works fine here. I'm getting the return I want
Now I want to take the 'COUNTYNO' that is returned and query the SQL database for a new Recordset
I've tried to mimmick what I've got above for a second recordset. But it doesn't like it.
SQL2 = "SELECT * FROM tblSSTP_RATE WHERE (JURISDICTION_FIPS = " & RecSet("COUNTYNO") & ""
Dim RecSet2
Set RecSet2 = CreateObject("ADODB.RecordSet")
RecSet2.Open SQL2, dbconnect
While Not RecSet2.EOF
Response.Write(RecSet2("GEN_TAX_RATE_INTRASTATE"))
Wend
Like I said. The SQL statements and the logic work fine in PHP. I'm just required to use ASP for this project.
Any help would be great, Thanks
I'm brand new to vbscript but have done this many times in PHP. I'm having some trouble with the second recordset
Here's my initial attempts:
''Having connected to the database
''Open the RecordSet
Dim SQL
SQL = "SELECT DISTINCT COUNTYNO,City_FIPS FROM tblALL_ZIP9 WHERE ZIPNINE = " & Zip9 & ""
Dim RecSet
Set RecSet = CreateObject("ADODB.RecordSet")
RecSet.Open SQL, dbconnect
While Not RecSet.EOF
Response.Write(RecSet("COUNTYNO") &"<br>")
RecSet.MoveNext
Wend
''''''Everything works fine here. I'm getting the return I want
Now I want to take the 'COUNTYNO' that is returned and query the SQL database for a new Recordset
I've tried to mimmick what I've got above for a second recordset. But it doesn't like it.
SQL2 = "SELECT * FROM tblSSTP_RATE WHERE (JURISDICTION_FIPS = " & RecSet("COUNTYNO") & ""
Dim RecSet2
Set RecSet2 = CreateObject("ADODB.RecordSet")
RecSet2.Open SQL2, dbconnect
While Not RecSet2.EOF
Response.Write(RecSet2("GEN_TAX_RATE_INTRASTATE"))
Wend
Like I said. The SQL statements and the logic work fine in PHP. I'm just required to use ASP for this project.
Any help would be great, Thanks