asp help

M

Matt Shudy

Hi,

I have a page that displays db results in a table. One
part of the asp code that makes this table is

Dim Field
Field = objNM("Field")

For i = 1 to 12
objPL.Filter="Month= " & i
If objPL(Field) <> "" Then
Response.Write "<TD>" & objPL(Field) & "</TD>"
Else
Resopnse.Write "<TD>&nbsp;</TD>"
End If
Next

Where objNM("Field") contains a list of all the row
headings ex.
field name filtered 1 to 12
Row one 1 2 3 4 5 6 7 8 9 10 11 12
Row two 1 2 3 4 5 6 7 8 9 10 11 12 and so on

The above code works fine, until objPL(Field)="", meaning
there is a row heading (ex Row three) but there is no data
to be displayed. With the above code the table will
populate until it gets to this, then it will error out and
stop populating the table. If i replace "If objPL(Field)
<> "" Then" with "If Not objPL.EOF Then" the table will
fully populate, but leave the rows with no data blank ex.

Row one 1 2 3 4 5 6 7 8 9 10 11 12
Row two 1 2 3 4 5 6 7 8 9 10 11 12
Row three
Row four 1 2 3 4 5 6 7 8 9 10 11 12

Is there something i can add to the above code so, if
there is no data for the given row heading it will just
print out a blank cell? So instead of printing out 12
cells with data in them, it would print out 12 blank
cells...

Thanks,

Matt Shudy
 
K

Kevin Spencer

Your terminology has left me completely confused. A database result set is
composed of rows and columns. I have no idea what a "row heading" is
supposed to be. I know that objPL must be a RecordSet, but you didn't
mention anything about the data type of the column "Field". And that is?

I have gleaned that at least you're counting your rows wrong. Apparently
you're using a filter to filter out some records, and it sounds like the
number of rows in your result set (RecordSet) is not 12.

Finally, you have a loop that creates HTML table cells (and no rows), but
your example shows multiple rows with multiple columns. I can't make out
from your explanation what this means.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Matt Shudy

Hi,

Sorry for any confusion...
The record set objNM contains a list of names in the
database table with the column name Field. There are 8
names. I have one Do while Not AllMyRecordsets.EOF loop,
so each time the loop goes through the objNM("Field") is
indexed to the next name (ex first time through name is
Row one, second time through name is Row two through Row
eight). The "i" counted loop is there because for each
objPL(Field) there are 12 different numbers (12 months of
data). So the first row of the html table is Row one
followed by the 12 pieces of data. Then Row two is
printed along with the 12 pieces of data. So the
recordset objNM contains the values Row one, Row two, Row
three, Row four... Row Eight. When the html table gets to
objNM("Field")="Row three" it errors out, because there is
no data in the objPL("Row three") database table.
However, I want to add a piece of code that checks for
that, and prints blank cells in the html table, then goes
on to the next value (Row four). The end html table would
look something like this.

Row one 1 2 3 4 5 6 7 8 9 10 11 12
Row two 1 2 3 4 5 6 7 8 9 10 11 12
Row three
Row four 1 2 3 4 5 6 7 8 9 10 11 12
Row five 1 2 3 4 5 6 7 8 9 10 11 12
Row six 1 2 3 4 5 6 7 8 9 10 11 12
Row seven 1 2 3 4 5 6 7 8 9 10 11 12
Row eight 1 2 3 4 5 6 7 8 9 10 11 12



Again, sorry I am not very good at explaining things..
Matt Shudy
 
K

Kevin Spencer

I think perhaps you ned to post all of the code from the opening of objNM to
the closing of same. You're mixture of narrative, pseudo-code and real code
has me completely baffled.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top