booboo0912
Programmer
I'm trying to pull data from a recordset, but when I assign values from the recordset to variables, then go to print out the variable, I get nothing! It seems once I exit my while statement, the variables return a blank. Please see code snipet below:
sSQL = "Select art_quality, COUNT(art_quality) as 'Total AQ' FROM table GROUP BY art_quality"
rs.Open(sSQL,conn);
if(!rs.EOF && !rs.BOF) {
rs.MoveFirst();
while(!rs.EOF) {
if(rs("art_quality") == 0) {
tot_AQ_NA = rs("Total AQ");
Response.write(tot_AQ_NA);
} else if(rs("art_quality") == 1) {
tot_AQ_VS = rs("Total AQ");
Response.write(tot_AQ_VS);
}
rs.MoveNext();
}
}
In my table, I try to print out the value of tot_AQ_NA and tot_AQ_VS, but it's blank. I put the Response.write in the while statement to see if my variables were being set, and they are, but when I put a Response.write outside of the while statement, the variable is blank. Here's what the recordset holds:
art_quality Total AQ
0 3
1 1
Any idea why my varibles aren't being returned outside of the while loop? Thanks in advance!
sSQL = "Select art_quality, COUNT(art_quality) as 'Total AQ' FROM table GROUP BY art_quality"
rs.Open(sSQL,conn);
if(!rs.EOF && !rs.BOF) {
rs.MoveFirst();
while(!rs.EOF) {
if(rs("art_quality") == 0) {
tot_AQ_NA = rs("Total AQ");
Response.write(tot_AQ_NA);
} else if(rs("art_quality") == 1) {
tot_AQ_VS = rs("Total AQ");
Response.write(tot_AQ_VS);
}
rs.MoveNext();
}
}
In my table, I try to print out the value of tot_AQ_NA and tot_AQ_VS, but it's blank. I put the Response.write in the while statement to see if my variables were being set, and they are, but when I put a Response.write outside of the while statement, the variable is blank. Here's what the recordset holds:
art_quality Total AQ
0 3
1 1
Any idea why my varibles aren't being returned outside of the while loop? Thanks in advance!