PC Review


Reply
 
 
Matt Shudy
Guest
Posts: n/a
 
      9th Jan 2004
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
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      9th Jan 2004
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.

"Matt Shudy" <(E-Mail Removed)> wrote in message
news:0a6d01c3d6af$290bb5c0$(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:18 AM.