Whats wrong with this picture?
-
I am attempting to query every table in my database and put the results in a record set, format the results to a cell string in html and print it out. The problem is that it is displaying only the results from the first table it matches to. Am I mistaken in thinking that it combines all results into one RS? If not, how do I accomplish what I want to do? The premise is this: I have several user request forms that output to their respective tables in my SQL Sevrver 2k DB. All the forms have the columns listed in the SELECT stametment below. I want to query all these tables for anything matching STATUS='OPEN' and display the results in a user queue. I have eliminated the HTML from the user queue page just to show what function I am trying to accomplish. Any help is GREATLY appreciated! (I aplogize for the sloppyness of the CELLSTRING & "<>" has been replaced with "[]") ============================CODE=========================== Dim objRS Dim strSQL Set objRS = Server.CreateObject("ADODB.Recordset") strSQL = "sp_MSforeachtable 'select submitDate, requestorLastName, requestorFirstName, urlToForm, nof, status from ?'" objRS.Open strSQL, MyConn if objRS.eof then response.redirect "noQueue.asp" else do until objRS.eof cellString = "[tr style='padding: 3'][td][font face='Arial' size='2' color='#CCCCCC'][center]" & objRS["submitDate"] & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("requestorFirstName") & " " & objRS("requestorLastName") & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & "[a href='" & objRS("urlToForm") & "'][font color='#66CCFF']" & objRS("nof") & "[/a]" & "[/center][/td][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("status") & "[/tr]" response.write(cellString) objRS.movenext loop end if
-
I am attempting to query every table in my database and put the results in a record set, format the results to a cell string in html and print it out. The problem is that it is displaying only the results from the first table it matches to. Am I mistaken in thinking that it combines all results into one RS? If not, how do I accomplish what I want to do? The premise is this: I have several user request forms that output to their respective tables in my SQL Sevrver 2k DB. All the forms have the columns listed in the SELECT stametment below. I want to query all these tables for anything matching STATUS='OPEN' and display the results in a user queue. I have eliminated the HTML from the user queue page just to show what function I am trying to accomplish. Any help is GREATLY appreciated! (I aplogize for the sloppyness of the CELLSTRING & "<>" has been replaced with "[]") ============================CODE=========================== Dim objRS Dim strSQL Set objRS = Server.CreateObject("ADODB.Recordset") strSQL = "sp_MSforeachtable 'select submitDate, requestorLastName, requestorFirstName, urlToForm, nof, status from ?'" objRS.Open strSQL, MyConn if objRS.eof then response.redirect "noQueue.asp" else do until objRS.eof cellString = "[tr style='padding: 3'][td][font face='Arial' size='2' color='#CCCCCC'][center]" & objRS["submitDate"] & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("requestorFirstName") & " " & objRS("requestorLastName") & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & "[a href='" & objRS("urlToForm") & "'][font color='#66CCFF']" & objRS("nof") & "[/a]" & "[/center][/td][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("status") & "[/tr]" response.write(cellString) objRS.movenext loop end if
-
The procedure probably does not return one recordset. Your other option is to create a SQL statement using UNION and put the select in for each table name.
-
I am attempting to query every table in my database and put the results in a record set, format the results to a cell string in html and print it out. The problem is that it is displaying only the results from the first table it matches to. Am I mistaken in thinking that it combines all results into one RS? If not, how do I accomplish what I want to do? The premise is this: I have several user request forms that output to their respective tables in my SQL Sevrver 2k DB. All the forms have the columns listed in the SELECT stametment below. I want to query all these tables for anything matching STATUS='OPEN' and display the results in a user queue. I have eliminated the HTML from the user queue page just to show what function I am trying to accomplish. Any help is GREATLY appreciated! (I aplogize for the sloppyness of the CELLSTRING & "<>" has been replaced with "[]") ============================CODE=========================== Dim objRS Dim strSQL Set objRS = Server.CreateObject("ADODB.Recordset") strSQL = "sp_MSforeachtable 'select submitDate, requestorLastName, requestorFirstName, urlToForm, nof, status from ?'" objRS.Open strSQL, MyConn if objRS.eof then response.redirect "noQueue.asp" else do until objRS.eof cellString = "[tr style='padding: 3'][td][font face='Arial' size='2' color='#CCCCCC'][center]" & objRS["submitDate"] & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("requestorFirstName") & " " & objRS("requestorLastName") & "[/center][td][font face='Arial' size='2' color='#FFFFFF'][center]" & "[a href='" & objRS("urlToForm") & "'][font color='#66CCFF']" & objRS("nof") & "[/a]" & "[/center][/td][td][font face='Arial' size='2' color='#FFFFFF'][center]" & objRS("status") & "[/tr]" response.write(cellString) objRS.movenext loop end if
As notadood mentioned, the storedproc is most probably not returning a single resultset, but rather a compound Recordset object. Take a look at
Recordset.NextRecordset
it may be what you're looking for.Bruce Duncan, CP#9088, CPUA 0xA1EE, Sonork 100.10030
'ugly naked women are good, when i'm not around, in front of someone else' - Shog9