asp help

  • Thread starter Thread starter Matt Shudy
  • Start date Start date
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
 
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.
 

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

Back
Top