Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Hiding data


Message #1 by "Ramli" <ramliabdel@y...> on Mon, 11 Dec 2000 15:30:10 -0000
Hi everyone,

I'm using ASP to display data stored within an Access DB. 

As all the cells in the DB do not all contain data, my pages shows some

unwanted blank areas that I wish to hide.

Is there any mean to hide these cells or to display a cell only if it

contains something.



Thank you.



Message #2 by Gregory_Griffiths@c... on Mon, 11 Dec 2000 15:38:24 +0000
check the length of the field as you read it into the ASP, if it > 0 

you can add it.



> -----Original Message-----

> From: ramliabdel@y... [mailto:ramliabdel@y...]

> Sent: 11 December 2000 15:30

> To: asp_web_howto@p...

> Subject: [asp_web_howto] Hiding data

> 

> 

> Hi everyone,

> I'm using ASP to display data stored within an Access DB. 

> As all the cells in the DB do not all contain data, my pages 

> shows some

> unwanted blank areas that I wish to hide.

> Is there any mean to hide these cells or to display a cell only if it

> contains something.

> 

> Thank you.

> 

> 

Message #3 by Scott Watermasysk <swatermasysk@C...> on Mon, 11 Dec 2000 10:44:00 -0500
You have quite a few options.



The first two that come to mind are:

1. Add a "WHERE" in you SQL Statement

2. Before writing a field to the page use:



RS = Your Record Set

F =  Your Fields



	 For Each F In RS.Fields        

		If F.Value <> "" Then

		' Add your code

		End If

	Next



-Scott

scott@c...

-----Original Message-----

From: Ramli [mailto:ramliabdel@y...]

Sent: Monday, December 11, 2000 10:30 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Hiding data





Hi everyone,

I'm using ASP to display data stored within an Access DB. 

As all the cells in the DB do not all contain data, my pages shows some

unwanted blank areas that I wish to hide.

Is there any mean to hide these cells or to display a cell only if it

contains something.



Thank you.



Message #4 by Gregory_Griffiths@c... on Mon, 11 Dec 2000 16:57:52 +0000

> -----Original Message-----

> From: swatermasysk@C...

> [mailto:swatermasysk@C...]

> Sent: 11 December 2000 15:44

> To: asp_web_howto@p...

> Cc: swatermasysk@C...

> Subject: [asp_web_howto] RE: Hiding data

> 

> 

> You have quite a few options.

> 

> The first two that come to mind are:

> 1. Add a "WHERE" in you SQL Statement



but, this may result in some fields you were after being not returned.



> 2. Before writing a field to the page use:

> 

> RS = Your Record Set

> F =  Your Fields

> 

> 	 For Each F In RS.Fields        

> 		If F.Value <> "" Then

> 		' Add your code

> 		End If

> 	Next

> 



much better approach, especially if this is included with any other 

parsing of your output data before sending it to the client.



> -Scott

> scott@c...

> -----Original Message-----

> From: Ramli [mailto:ramliabdel@y...]

> Sent: Monday, December 11, 2000 10:30 AM

> To: ASP Web HowTo

> Subject: [asp_web_howto] Hiding data

> 

> 

> Hi everyone,

> I'm using ASP to display data stored within an Access DB. 

> As all the cells in the DB do not all contain data, my pages 

> shows some

> unwanted blank areas that I wish to hide.

> Is there any mean to hide these cells or to display a cell only if it

> contains something.

> 

> Thank you.

> 

> 

 



Message #5 by "Ken Schaefer" <ken@a...> on Tue, 12 Dec 2000 12:17:47 +1100
> > You have quite a few options.

> >

> > The first two that come to mind are:

> > 1. Add a "WHERE" in you SQL Statement

>

> but, this may result in some fields you were after being not returned.



Thinking about this...AFAIK the WHERE clause can only be used to restrict

the number of records returned, it wont result in some fields being

missing...The SELECT clause determines which fields are retrieved.



Cheers

Ken





Message #6 by "ramliabdel" <ramliabdel@y...> on Tue, 12 Dec 2000 11:18:42 +0100
Thanx for all your replies,

I understand that the select clause will show only the corresponding data,

but in the case I want to use <TR> and <TD> tags to display each of all the

cells of the DB that match my query,

I will have to write something like the following :



.........

"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

........ and so on .



So you understand that a row and column will be created in order to insert

the FieldX into it.

If, the FieldX cell into the DB is blank, the row and column will be created

anyway, with nothing inside, and this will cause an unconvenient blank area

because it shows to my visitors that my DB isn't complete.



In my case, the reasons why into the DB, some cells may be missing, is

simply because for example, I've got phone and fax numbers, and some people

do not have fax numbers. Sometimes, the cells are empty simply because the

data isn't available.

And what I would like to do is not to show that an information is missing by

avoiding blank spaces and so on.



Thankx







----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, December 12, 2000 2:17 AM

Subject: [asp_web_howto] RE: Hiding data





> > > You have quite a few options.

> > >

> > > The first two that come to mind are:

> > > 1. Add a "WHERE" in you SQL Statement

> >

> > but, this may result in some fields you were after being not returned.

>

> Thinking about this...AFAIK the WHERE clause can only be used to restrict

> the number of records returned, it wont result in some fields being

> missing...The SELECT clause determines which fields are retrieved.

>

> Cheers

> Ken

>

>

>

Message #7 by "Majid Qazi" <majid@i...> on Tue, 12 Dec 2000 06:28:15 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0093_01C06404.B59791B0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



<TR> and <TD> tags are for the table rows and cells. It has nothing to 

do with the presentation of data to your visitors on the Web except 

formatting the content.



The real crux of the solutions to your problem is to check that whether 

the fields in the recordset have any data or not. If the field is not 

empty then you can show it and if it is empty then the code will skip 

it.



The actual block of code that performs this check is the "IF" block i.e.



if objRS("FieldX") <>"" then

    Response.Write(objRS("FieldX") )

end if



I hope it will help.



Majid Qazi

  ----- Original Message -----

  From: ramliabdel

  To: ASP Web HowTo

  Sent: Tuesday, December 12, 2000 5:18 AM

  Subject: [asp_web_howto] RE: Hiding data





  Thanx for all your replies,

  I understand that the select clause will show only the corresponding 

data,

  but in the case I want to use <TR> and <TD> tags to display each of 

all the

  cells of the DB that match my query,

  I will have to write something like the following :



  .........

  "<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

  ........ and so on .



  So you understand that a row and column will be created in order to 

insert

  the FieldX into it.

  If, the FieldX cell into the DB is blank, the row and column will be 

created

  anyway, with nothing inside, and this will cause an unconvenient blank 

area

  because it shows to my visitors that my DB isn't complete.



  In my case, the reasons why into the DB, some cells may be missing, is

  simply because for example, I've got phone and fax numbers, and some 

people

  do not have fax numbers. Sometimes, the cells are empty simply because 

the

  data isn't available.

  And what I would like to do is not to show that an information is 

missing by

  avoiding blank spaces and so on.



  Thankx







  ----- Original Message -----

  From: "Ken Schaefer" <ken@a...>

  To: "ASP Web HowTo" <asp_web_howto@p...>

  Sent: Tuesday, December 12, 2000 2:17 AM

  Subject: [asp_web_howto] RE: Hiding data





  > > > You have quite a few options.

  > > >

  > > > The first two that come to mind are:

  > > > 1. Add a "WHERE" in you SQL Statement

  > >

  > > but, this may result in some fields you were after being not 

returned.

  >

  > Thinking about this...AFAIK the WHERE clause can only be used to 

restrict

  > the number of records returned, it wont result in some fields being

  > missing...The SELECT clause determines which fields are retrieved.

  >

  > Cheers

  > Ken

  >

  >

  >



  ---

  MaximumASP offers enhanced hosting solutions on the Windows 2000 

platform. Dedicated processor, RAM, and server resources provide 

dedicated server performance at virtual server prices. Commercial 

components provided; custom components allowed.




$subst('Email.Unsub')














Message #8 by Imar Spaanjaars <Imar@S...> on Tue, 12 Dec 2000 11:56:11 +0100
You have to check the data before you write a <TR> to the browser.



Dim aValue

aValue = objRS("FieldX") & ""

if aValue <> "" then

         Response.Write("<TR><TD>" & aValue & "</TD></TR>")

end if



I assign the value of objRS("FieldX") to a local variable called aValue. I 

do this because it is faster to reference a local variable than to 

reference the recordset,.

However, this should work just as well:



if objRS("FieldX") <> "" then

         Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

end if



HtH



Imar





At 11:18 AM 12/12/2000 +0100, you wrote:

>Thanx for all your replies,

>I understand that the select clause will show only the corresponding data,

>but in the case I want to use <TR> and <TD> tags to display each of all the

>cells of the DB that match my query,

>I will have to write something like the following :

>

>.........

>"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

>........ and so on .

>

>So you understand that a row and column will be created in order to insert

>the FieldX into it.

>If, the FieldX cell into the DB is blank, the row and column will be created

>anyway, with nothing inside, and this will cause an unconvenient blank area

>because it shows to my visitors that my DB isn't complete.

>

>In my case, the reasons why into the DB, some cells may be missing, is

>simply because for example, I've got phone and fax numbers, and some people

>do not have fax numbers. Sometimes, the cells are empty simply because the

>data isn't available.

>And what I would like to do is not to show that an information is missing by

>avoiding blank spaces and so on.

>

>Thankx

>

>

>

>----- Original Message -----

>From: "Ken Schaefer" <ken@a...>

>To: "ASP Web HowTo" <asp_web_howto@p...>

>Sent: Tuesday, December 12, 2000 2:17 AM

>Subject: [asp_web_howto] RE: Hiding data

>

>

> > > > You have quite a few options.

> > > >

> > > > The first two that come to mind are:

> > > > 1. Add a "WHERE" in you SQL Statement

> > >

> > > but, this may result in some fields you were after being not returned.

> >

> > Thinking about this...AFAIK the WHERE clause can only be used to restrict

> > the number of records returned, it wont result in some fields being

> > missing...The SELECT clause determines which fields are retrieved.

> >

> > Cheers

> > Ken

> >

> >

> >

>

Message #9 by Gregory_Griffiths@c... on Tue, 12 Dec 2000 10:58:45 +0000
try using something like :



if (len(Cstr(FieldX))>0) then

	FieldX="No Data Supplied"

end if



> -----Original Message-----

> From: ramliabdel@y... [mailto:ramliabdel@y...]

> Sent: 12 December 2000 10:19

> To: asp_web_howto@p...

> Cc: ramliabdel@y...

> Subject: [asp_web_howto] RE: Hiding data

> 

> 

> Thanx for all your replies,

> I understand that the select clause will show only the 

> corresponding data,

> but in the case I want to use <TR> and <TD> tags to display 

> each of all the

> cells of the DB that match my query,

> I will have to write something like the following :

> 

> .........

> "<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> ........ and so on .

> 

> So you understand that a row and column will be created in 

> order to insert

> the FieldX into it.

> If, the FieldX cell into the DB is blank, the row and column 

> will be created

> anyway, with nothing inside, and this will cause an 

> unconvenient blank area

> because it shows to my visitors that my DB isn't complete.

> 

> In my case, the reasons why into the DB, some cells may be missing, is

> simply because for example, I've got phone and fax numbers, 

> and some people

> do not have fax numbers. Sometimes, the cells are empty 

> simply because the

> data isn't available.

> And what I would like to do is not to show that an 

> information is missing by

> avoiding blank spaces and so on.

> 

> Thankx

> 

> 

> 

> ----- Original Message -----

> From: "Ken Schaefer" <ken@a...>

> To: "ASP Web HowTo" <asp_web_howto@p...>

> Sent: Tuesday, December 12, 2000 2:17 AM

> Subject: [asp_web_howto] RE: Hiding data

> 

> 

> > > > You have quite a few options.

> > > >

> > > > The first two that come to mind are:

> > > > 1. Add a "WHERE" in you SQL Statement

> > >

> > > but, this may result in some fields you were after being 

> not returned.

> >

> > Thinking about this...AFAIK the WHERE clause can only be 

> used to restrict

> > the number of records returned, it wont result in some fields being

> > missing...The SELECT clause determines which fields are retrieved.

> >

> > Cheers

> > Ken

> >

> >

> >





Message #10 by PERRETTA Franco <Franco.PERRETTA@c...> on Tue, 12 Dec 2000 12:02:30 +0100
Dear

	Just add the space syntax for each row.



.........

"<TR><TD>" & objRS("FieldX") &  " </TD></TR>" & _

            ........





             Franco

___________________________________

                     Perretta Franco

                           Council of Europe

           Department of Information Technology

                      Information Access Unit

                     67075 Strasbourg Cedex

tel: +33 (0)3 88 41 22 18  fax: +33 (0)3 88 41 27 39

          mailto:franco.perretta@c...

                    http://www.coe.int



 -----Original Message-----

From: 	ramliabdel [mailto:ramliabdel@y...] 

Sent:	Tuesday 12 December 2000 11:19

To:	ASP Web HowTo

Subject:	[asp_web_howto] RE: Hiding data



Thanx for all your replies,

I understand that the select clause will show only the corresponding data,

but in the case I want to use <TR> and <TD> tags to display each of all the

cells of the DB that match my query,

I will have to write something like the following :



.........

"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

........ and so on .



So you understand that a row and column will be created in order to insert

the FieldX into it.

If, the FieldX cell into the DB is blank, the row and column will be created

anyway, with nothing inside, and this will cause an unconvenient blank area

because it shows to my visitors that my DB isn't complete.



In my case, the reasons why into the DB, some cells may be missing, is

simply because for example, I've got phone and fax numbers, and some people

do not have fax numbers. Sometimes, the cells are empty simply because the

data isn't available.

And what I would like to do is not to show that an information is missing by

avoiding blank spaces and so on.



Thankx







----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, December 12, 2000 2:17 AM

Subject: [asp_web_howto] RE: Hiding data





> > > You have quite a few options.

> > >

> > > The first two that come to mind are:

> > > 1. Add a "WHERE" in you SQL Statement

> >

> > but, this may result in some fields you were after being not returned.

>

> Thinking about this...AFAIK the WHERE clause can only be used to restrict

> the number of records returned, it wont result in some fields being

> missing...The SELECT clause determines which fields are retrieved.

>

> Cheers

> Ken

>

>

>



Message #11 by "Majid Qazi" <majid@i...> on Tue, 12 Dec 2000 08:22:16 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_001C_01C06414.A33A3BC0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable





Perhaps it is a typo; instead of > operator, it should be =3D in the if 

statement below i.e.



if (len(Cstr(FieldX))=3D0) then



-Majid

  ----- Original Message -----

  From: Gregory_Griffiths@c...

  To: ASP Web HowTo

  Sent: Tuesday, December 12, 2000 5:58 AM

  Subject: [asp_web_howto] RE: Hiding data





  try using something like :



  if (len(Cstr(FieldX))>0) then

  FieldX=3D"No Data Supplied"

  end if



  > -----Original Message-----

  > From: ramliabdel@y... [mailto:ramliabdel@y...]

  > Sent: 12 December 2000 10:19

  > To: asp_web_howto@p...

  > Cc: ramliabdel@y...

  > Subject: [asp_web_howto] RE: Hiding data

  >

  >

  > Thanx for all your replies,

  > I understand that the select clause will show only the

  > corresponding data,

  > but in the case I want to use <TR> and <TD> tags to display

  > each of all the

  > cells of the DB that match my query,

  > I will have to write something like the following :

  >

  > .........

  > "<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

  > ........ and so on .

  >

  > So you understand that a row and column will be created in

  > order to insert

  > the FieldX into it.

  > If, the FieldX cell into the DB is blank, the row and column

  > will be created

  > anyway, with nothing inside, and this will cause an

  > unconvenient blank area

  > because it shows to my visitors that my DB isn't complete.

  >

  > In my case, the reasons why into the DB, some cells may be missing, 

is

  > simply because for example, I've got phone and fax numbers,

  > and some people

  > do not have fax numbers. Sometimes, the cells are empty

  > simply because the

  > data isn't available.

  > And what I would like to do is not to show that an

  > information is missing by

  > avoiding blank spaces and so on.

  >

  > Thankx

  >

  >

  >

  > ----- Original Message -----

  > From: "Ken Schaefer" <ken@a...>

  > To: "ASP Web HowTo" <asp_web_howto@p...>

  > Sent: Tuesday, December 12, 2000 2:17 AM

  > Subject: [asp_web_howto] RE: Hiding data

  >

  >

  > > > > You have quite a few options.

  > > > >

  > > > > The first two that come to mind are:

  > > > > 1. Add a "WHERE" in you SQL Statement

  > > >

  > > > but, this may result in some fields you were after being

  > not returned.

  > >

  > > Thinking about this...AFAIK the WHERE clause can only be

  > used to restrict

  > > the number of records returned, it wont result in some fields 

being

  > > missing...The SELECT clause determines which fields are retrieved.

  > >

  > > Cheers

  > > Ken

  > >

  > >

  > >







  ---

  MaximumASP offers enhanced hosting solutions on the Windows 2000 

platform. Dedicated processor, RAM, and server resources provide 

dedicated server performance at virtual server prices. Commercial 

components provided; custom components allowed.




$subst('Email.Unsub')














Message #12 by "ramliabdel" <ramliabdel@y...> on Tue, 12 Dec 2000 14:00:01 +0100
Thanx for your helpful answers, guy,



I do understand what I should do

I can use if statement, but how can I apply it in a long codes



Here are my codes

Do I need a single if statement for each of the fields, if so how to include

them within te following ? :



<%



  Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

  Set objRS = Server.CreateObject("ADODB.Recordset")

  strDirector = Request.Form("director")

  strCountry = Request.Form("Country")





  strSQL = "SELECT * "

  strSQL = strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON Ecole08.TableID 

Donnees08.TableID "

  strSQL = strSQL & "WHERE (Ecole08.Ville = '" & strDirector & "' AND

Ecole08.Catégorie ='" & strCountry & "' OR Ecole08.Ville = '" & strDirector

& "')"

  strSQL = strSQL & "ORDER BY Ecole08.Ville"



 objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText



  If objRS.EOF Then

Response.Write "<H3>error message: " & strDirector

  Else

Response.write "<H3> " & strDirector & "<BR></H3>" & _

"<font size=""2"">Téléphone de la Mairie : " & objRS("TélMairie") & "<BR>" &

_

"<B> " & objRS("FaxMairie")



do while not objRS.EOF



  Response.Write "<table width=""95%"" border=""0"" cellspacing=""1""

cellpadding=""0"" height="""" bgcolor=""white"" align=""center"">" & _



"<TR><TD><font size=""1"">Circonscription :<B><font size=""2""> " &

objRS("Circons") & "</TD>" & _

"<TD><font size=""1"">Direction : <font size=""2""><B> "& objRS("Direction")

& "</TD></TR>" & _



"<TR><TD><font size=""1""><BR>Coordonnateur ZEP : <font size=""1""><B>" &

objRS("CoordonnateurZEP") & "</b><BR></TR>" & _



"<TR><TD colspan=""2""><font size=""1""> Regroupement Pédagogique <font

size=""2"">" & objRS("Ville1") & "  " & _

"<font size=""2"">" & objRS("Ville2") & "  " & _

"<font size=""2"">" & objRS("Ville3") & "</TD></TR>" & _



"<TR><TD colspan=""2""> <font size=""1""> Assoc. Parents d'élèves : <font

size=""2""> <B>" & objRS("Parentélu") & "</b></TD></TR>" & _

"<BR><IMG SRC=""educinfo_files/fil.gif"" width=""250""

height=""1""><BR><BR></TABLE>" & _





objRS.MoveNext

loop

  End If

  objRS.Close

  Set objRS = Nothing

%>









Thank you very much









----- Original Message -----

From: "Imar Spaanjaars" <Imar@S...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, December 12, 2000 11:56 AM

Subject: [asp_web_howto] RE: Hiding data





> You have to check the data before you write a <TR> to the browser.

>

> Dim aValue

> aValue = objRS("FieldX") & ""

> if aValue <> "" then

>          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

> end if

>

> I assign the value of objRS("FieldX") to a local variable called aValue. I

> do this because it is faster to reference a local variable than to

> reference the recordset,.

> However, this should work just as well:

>

> if objRS("FieldX") <> "" then

>          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

> end if

>

> HtH

>

> Imar

>

>

> At 11:18 AM 12/12/2000 +0100, you wrote:

> >Thanx for all your replies,

> >I understand that the select clause will show only the corresponding

data,

> >but in the case I want to use <TR> and <TD> tags to display each of all

the

> >cells of the DB that match my query,

> >I will have to write something like the following :

> >

> >.........

> >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> >........ and so on .

> >

> >So you understand that a row and column will be created in order to

insert

> >the FieldX into it.

> >If, the FieldX cell into the DB is blank, the row and column will be

created

> >anyway, with nothing inside, and this will cause an unconvenient blank

area

> >because it shows to my visitors that my DB isn't complete.

> >

> >In my case, the reasons why into the DB, some cells may be missing, is

> >simply because for example, I've got phone and fax numbers, and some

people

> >do not have fax numbers. Sometimes, the cells are empty simply because

the

> >data isn't available.

> >And what I would like to do is not to show that an information is missing

by

> >avoiding blank spaces and so on.

> >

> >Thankx

> >

> >

> >



> >----- Original Message -----

> >From: "Ken Schaefer" <ken@a...>

> >To: "ASP Web HowTo" <asp_web_howto@p...>

> >Sent: Tuesday, December 12, 2000 2:17 AM

> >Subject: [asp_web_howto] RE: Hiding data

> >

> >

> > > > > You have quite a few options.

> > > > >

> > > > > The first two that come to mind are:

> > > > > 1. Add a "WHERE" in you SQL Statement

> > > >

> > > > but, this may result in some fields you were after being not

returned.

> > >

> > > Thinking about this...AFAIK the WHERE clause can only be used to

restrict

> > > the number of records returned, it wont result in some fields being

> > > missing...The SELECT clause determines which fields are retrieved.

> > >

> > > Cheers

> > > Ken

> > >

> > >

> > >

> >

>

Message #13 by Imar Spaanjaars <Imar@S...> on Tue, 12 Dec 2000 15:12:16 +0100
Hi there,



To make your code more readable, I'd wrap up this functionality in a sub.



You can define the sub inside your page, or somewhere in an include file.

Something like this will do the trick:



Sub writeTableLine(aRecordsetValue)

         Dim sValue ' as String

         sValue =3D aRecordsetValue & ""  ' Localize the value. Not strictly



necessary

         if sValue <> "" then

                 Response.Write("<TR><TD>" & sValue & "</td></tr>")

         end if

end Sub



The nice thing about this code, is that it will make your complete code

more readable. Now the loop will look like this:



' Write one table tag OUTSIDE the loop

Response.Write "<table width=3D""95%"" border=3D""0"" cellspacing=3D""1""

cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" align=3D""center"">"

do while not objRS.EOF

         writeTableLine objRS("Circons")

         writeTableLine objRS("Direction")

         writeTableLine objRS("CoordonnateurZEP")

         writeTableLine objRS("Ville1")

         writeTableLine objRS("Ville2")

         writeTableLine objRS("Ville3")

         writeTableLine objRS("Parent=E9lu")



         objRS.MoveNext

loop

End If

Response.Write("<BR><BR></TABLE>")

objRS.Close

Set objRS =3D Nothing

%>



Note that this code only writes the values of the recordset. It does not

write the "labels" you gave to all the rows. You can easily do this

yourself by modifying the sub. You could for instance add an extra

parameter, called Description. Inside the sub, write the Description in an



extra <TD> tag.

One of the advantages of this way of doing it is that your code is easy to



read. But it's also more maintainable. Suppose you want to add an extra

field.... All you have to do is insert an extra call to writeTableLine. No



need to insert extra <TR>, <TD> etc.



Or change the sub to write only a <TD> and write out the <TR> in the main

code. Lot's of options available, as you can see. It depends on your

particular needs and personal taste how you can implement this.



HtH





Imar







At 02:00 PM 12/12/2000 +0100, you wrote:

>Thanx for your helpful answers, guy,

>

>I do understand what I should do

>I can use if statement, but how can I apply it in a long codes

>

>Here are my codes

>Do I need a single if statement for each of the fields, if so how to

 include

>them within te following ? :

>

><%

>

>   Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

>   Set objRS =3D Server.CreateObject("ADODB.Recordset")

>   strDirector =3D Request.Form("director")

>   strCountry =3D Request.Form("Country")

>

>

>   strSQL =3D "SELECT * "

>   strSQL =3D strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON

 Ecole08.TableID =3D

>Donnees08.TableID "

>   strSQL =3D strSQL & "WHERE (Ecole08.Ville =3D '" & strDirector & "' AND

>Ecole08.Cat=E9gorie =3D'" & strCountry & "' OR Ecole08.Ville =3D '" &

 strDirector

>& "')"

>   strSQL =3D strSQL & "ORDER BY Ecole08.Ville"

>

>  objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

 adCmdText

>

>   If objRS.EOF Then

>Response.Write "<H3>error message: " & strDirector

>   Else

>Response.write "<H3> " & strDirector & "<BR></H3>" & _

>"<font size=3D""2"">T=E9l=E9phone de la Mairie : " & objRS("T=E9lMairie") &

 "<BR>" &

>_

>"<B> " & objRS("FaxMairie")

>

>do while not objRS.EOF

>

>   Response.Write "<table width=3D""95%"" border=3D""0"" cellspacing=3D""1"

"

>cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" align=3D""center"">"

 & _

>

>"<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " &

>objRS("Circons") & "</TD>" & _

>"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "&

 objRS("Direction")

>& "</TD></TR>" & _

>

>"<TR><TD><font size=3D""1""><BR>Coordonnateur ZEP : <font size=3D""1""><B>"

 &

>objRS("CoordonnateurZEP") & "</b><BR></TR>" & _

>

>"<TR><TD colspan=3D""2""><font size=3D""1""> Regroupement P=E9dagogique

 <font

>size=3D""2"">" & objRS("Ville1") & "  " & _

>"<font size=3D""2"">" & objRS("Ville2") & "  " & _

>"<font size=3D""2"">" & objRS("Ville3") & "</TD></TR>" & _

>

>"<TR><TD colspan=3D""2""> <font size=3D""1""> Assoc. Parents d'=E9l=E8ves :

 <font

>size=3D""2""> <B>" & objRS("Parent=E9lu") & "</b></TD></TR>" & _

>"<BR><IMG SRC=3D""educinfo_files/fil.gif"" width=3D""250""

>height=3D""1""><BR><BR></TABLE>" & _

>

>

>objRS.MoveNext

>loop

>   End If

>   objRS.Close

>   Set objRS =3D Nothing

>%>

>

>

>

>

>Thank you very much

>

>

>

>

>----- Original Message -----

>From: "Imar Spaanjaars" <Imar@S...>

>To: "ASP Web HowTo" <asp_web_howto@p...>

>Sent: Tuesday, December 12, 2000 11:56 AM

>Subject: [asp_web_howto] RE: Hiding data

>

>

> > You have to check the data before you write a <TR> to the browser.

> >

> > Dim aValue

> > aValue =3D objRS("FieldX") & ""

> > if aValue <> "" then

> >          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

> > end if

> >

> > I assign the value of objRS("FieldX") to a local variable called aValue.

 I

> > do this because it is faster to reference a local variable than to

> > reference the recordset,.

> > However, this should work just as well:

> >

> > if objRS("FieldX") <> "" then

> >          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

> > end if

> >

> > HtH

> >

> > Imar

> >

> >

> > At 11:18 AM 12/12/2000 +0100, you wrote:

> > >Thanx for all your replies,

> > >I understand that the select clause will show only the corresponding

>data,

> > >but in the case I want to use <TR> and <TD> tags to display each of all

>the

> > >cells of the DB that match my query,

> > >I will have to write something like the following :

> > >

> > >.........

> > >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> > >........ and so on .

> > >

> > >So you understand that a row and column will be created in order to

>insert

> > >the FieldX into it.

> > >If, the FieldX cell into the DB is blank, the row and column will be

>created

> > >anyway, with nothing inside, and this will cause an unconvenient blank

>area

> > >because it shows to my visitors that my DB isn't complete.

> > >

> > >In my case, the reasons why into the DB, some cells may be missing, is

> > >simply because for example, I've got phone and fax numbers, and some

>people

> > >do not have fax numbers. Sometimes, the cells are empty simply because

>the

> > >data isn't available.

> > >And what I would like to do is not to show that an information is

 missing

>by

> > >avoiding blank spaces and so on.

> > >

> > >Thankx

> > >

> > >

> > >

>

> > >----- Original Message -----

> > >From: "Ken Schaefer" <ken@a...>

> > >To: "ASP Web HowTo" <asp_web_howto@p...>

> > >Sent: Tuesday, December 12, 2000 2:17 AM

> > >Subject: [asp_web_howto] RE: Hiding data

> > >

> > >

> > > > > > You have quite a few options.

> > > > > >

> > > > > > The first two that come to mind are:

> > > > > > 1. Add a "WHERE" in you SQL Statement

> > > > >

> > > > > but, this may result in some fields you were after being not

>returned.

> > > >

> > > > Thinking about this...AFAIK the WHERE clause can only be used to

>restrict

> > > > the number of records returned, it wont result in some fields being

> > > > missing...The SELECT clause determines which fields are retrieved.

> > > >

> > > > Cheers

> > > > Ken

> > > >

> > > >

> > > >

> > >

> >

>



---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #14 by "Whitmore, Todd x78046" <WhitmorT@b...> on Tue, 12 Dec 2000 08:56:09 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C06443.A472A69C

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



write a little function such as



Function getField(strInput)

   if (len(strInput) =3D 0) Then

	getField =3D " "

   else

      getField =3D strInput

   End If

End Function





and then call it later on:



"<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " &

getField(objRS("Circons")) & "</TD>" & _

"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "&

getField(objRS("Direction")) & "</TD></TR>" & _

etc...



-----Original Message-----

From: ramliabdel [mailto:ramliabdel@y...]

Sent: Tuesday, December 12, 2000 8:00 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Hiding data





Thanx for your helpful answers, guy,



I do understand what I should do

I can use if statement, but how can I apply it in a long codes



Here are my codes

Do I need a single if statement for each of the fields, if so how to 

include

them within te following ? :



<%



  Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

  Set objRS =3D Server.CreateObject("ADODB.Recordset")

  strDirector =3D Request.Form("director")

  strCountry =3D Request.Form("Country")





  strSQL =3D "SELECT * "

  strSQL =3D strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON 

Ecole08.TableID =3D

Donnees08.TableID "

  strSQL =3D strSQL & "WHERE (Ecole08.Ville =3D '" & strDirector & "' 

AND

Ecole08.Cat=E9gorie =3D'" & strCountry & "' OR Ecole08.Ville =3D '" & 

strDirector

& "')"

  strSQL =3D strSQL & "ORDER BY Ecole08.Ville"



 objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, 

adCmdText



  If objRS.EOF Then

Response.Write "<H3>error message: " & strDirector

  Else

Response.write "<H3> " & strDirector & "<BR></H3>" & _

"<font size=3D""2"">T=E9l=E9phone de la Mairie : " & 

objRS("T=E9lMairie") & "<BR>" &

_

"<B> " & objRS("FaxMairie")



do while not objRS.EOF



  Response.Write "<table width=3D""95%"" border=3D""0"" 

cellspacing=3D""1""

cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" 

align=3D""center"">" & _



"<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " &

objRS("Circons") & "</TD>" & _

"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "& 

objRS("Direction")

& "</TD></TR>" & _



"<TR><TD><font size=3D""1""><BR>Coordonnateur ZEP : <font 

size=3D""1""><B>" &

objRS("CoordonnateurZEP") & "</b><BR></TR>" & _



"<TR><TD colspan=3D""2""><font size=3D""1""> Regroupement P=E9dagogique 

<font

size=3D""2"">" & objRS("Ville1") & "  " & _

"<font size=3D""2"">" & objRS("Ville2") & "  " & _

"<font size=3D""2"">" & objRS("Ville3") & "</TD></TR>" & _



"<TR><TD colspan=3D""2""> <font size=3D""1""> Assoc. Parents 

d'=E9l=E8ves : <font

size=3D""2""> <B>" & objRS("Parent=E9lu") & "</b></TD></TR>" & _

"<BR><IMG SRC=3D""educinfo_files/fil.gif"" width=3D""250""

height=3D""1""><BR><BR></TABLE>" & _





objRS.MoveNext

loop

  End If

  objRS.Close

  Set objRS =3D Nothing

%>









Thank you very much









----- Original Message -----

From: "Imar Spaanjaars" <Imar@S...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, December 12, 2000 11:56 AM

Subject: [asp_web_howto] RE: Hiding data





> You have to check the data before you write a <TR> to the browser.

>

> Dim aValue

> aValue =3D objRS("FieldX") & ""

> if aValue <> "" then

>          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

> end if

>

> I assign the value of objRS("FieldX") to a local variable called 

aValue. I

> do this because it is faster to reference a local variable than to

> reference the recordset,.

> However, this should work just as well:

>

> if objRS("FieldX") <> "" then

>          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

> end if

>

> HtH

>

> Imar

>

>

> At 11:18 AM 12/12/2000 +0100, you wrote:

> >Thanx for all your replies,

> >I understand that the select clause will show only the corresponding

data,

> >but in the case I want to use <TR> and <TD> tags to display each of 

all

the

> >cells of the DB that match my query,

> >I will have to write something like the following :

> >

> >.........

> >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> >........ and so on .

> >

> >So you understand that a row and column will be created in order to

insert

> >the FieldX into it.

> >If, the FieldX cell into the DB is blank, the row and column will be

created

> >anyway, with nothing inside, and this will cause an unconvenient 

blank

area

> >because it shows to my visitors that my DB isn't complete.

> >

> >In my case, the reasons why into the DB, some cells may be missing, 

is

> >simply because for example, I've got phone and fax numbers, and some

people

> >do not have fax numbers. Sometimes, the cells are empty simply 

because

the

> >data isn't available.

> >And what I would like to do is not to show that an information is 

missing

by

> >avoiding blank spaces and so on.

> >

> >Thankx

> >

> >

> >



> >----- Original Message -----

> >From: "Ken Schaefer" <ken@a...>

> >To: "ASP Web HowTo" <asp_web_howto@p...>

> >Sent: Tuesday, December 12, 2000 2:17 AM

> >Subject: [asp_web_howto] RE: Hiding data

> >

> >

> > > > > You have quite a few options.

> > > > >

> > > > > The first two that come to mind are:

> > > > > 1. Add a "WHERE" in you SQL Statement

> > > >

> > > > but, this may result in some fields you were after being not

returned.

> > >

> > > Thinking about this...AFAIK the WHERE clause can only be used to

restrict

> > > the number of records returned, it wont result in some fields 

being

> > > missing...The SELECT clause determines which fields are 

retrieved.

> > >

> > > Cheers

> > > Ken

> > >

> > >

> > >

> >

>



---

MaximumASP offers enhanced hosting solutions on the Windows 2000 

platform.

Dedicated processor, RAM, and server resources provide dedicated server

performance at virtual server prices. Commercial components provided; 

custom

components allowed.




leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com





---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com






Message #15 by "Majid Qazi" <majid@i...> on Tue, 12 Dec 2000 09:44:47 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0015_01C06420.2A6B73B0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable







If  cStr(objRS("Direction"))<>""  AND cstr(objRS("Circons"))<>"" Then

Response.Write("<TR><TD><font size=3D""1"">Circonscription :<B><font 

size=3D""2""> " &

objRS("Circons") & "</TD>" & _

"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "& 

objRS("Direction")

& "</TD></TR>")

End if



-Majid



  ----- Original Message -----

  From: ramliabdel

  To: ASP Web HowTo

  Sent: Tuesday, December 12, 2000 8:00 AM

  Subject: [asp_web_howto] RE: Hiding data





  Thanx for your helpful answers, guy,



  I do understand what I should do

  I can use if statement, but how can I apply it in a long codes



  Here are my codes

  Do I need a single if statement for each of the fields, if so how to 

include

  them within te following ? :



  <%



    Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

    Set objRS =3D Server.CreateObject("ADODB.Recordset")

    strDirector =3D Request.Form("director")

    strCountry =3D Request.Form("Country")





    strSQL =3D "SELECT * "

    strSQL =3D strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON 

Ecole08.TableID =3D

  Donnees08.TableID "

    strSQL =3D strSQL & "WHERE (Ecole08.Ville =3D '" & strDirector & "' 

AND

  Ecole08.Cat=E9gorie =3D'" & strCountry & "' OR Ecole08.Ville =3D '" & 

strDirector

  & "')"

    strSQL =3D strSQL & "ORDER BY Ecole08.Ville"



   objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, 

adCmdText



    If objRS.EOF Then

  Response.Write "<H3>error message: " & strDirector

    Else

  Response.write "<H3> " & strDirector & "<BR></H3>" & _

  "<font size=3D""2"">T=E9l=E9phone de la Mairie : " & 

objRS("T=E9lMairie") & "<BR>" &

  _

  "<B> " & objRS("FaxMairie")



  do while not objRS.EOF



    Response.Write "<table width=3D""95%"" border=3D""0"" 

cellspacing=3D""1""

  cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" 

align=3D""center"">" & _



  "<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " 

&

  objRS("Circons") & "</TD>" & _

  "<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "& 

objRS("Direction")

  & "</TD></TR>" & _



  "<TR><TD><font size=3D""1""><BR>Coordonnateur ZEP : <font 

size=3D""1""><B>" &

  objRS("CoordonnateurZEP") & "</b><BR></TR>" & _



  "<TR><TD colspan=3D""2""><font size=3D""1""> Regroupement 

P=E9dagogique <font

  size=3D""2"">" & objRS("Ville1") & "  " & _

  "<font size=3D""2"">" & objRS("Ville2") & "  " & _

  "<font size=3D""2"">" & objRS("Ville3") & "</TD></TR>" & _



  "<TR><TD colspan=3D""2""> <font size=3D""1""> Assoc. Parents 

d'=E9l=E8ves : <font

  size=3D""2""> <B>" & objRS("Parent=E9lu") & "</b></TD></TR>" & _

  "<BR><IMG SRC=3D""educinfo_files/fil.gif"" width=3D""250""

  height=3D""1""><BR><BR></TABLE>" & _





  objRS.MoveNext

  loop

    End If

    objRS.Close

    Set objRS =3D Nothing

  %>









  Thank you very much









  ----- Original Message -----

  From: "Imar Spaanjaars" <Imar@S...>

  To: "ASP Web HowTo" <asp_web_howto@p...>

  Sent: Tuesday, December 12, 2000 11:56 AM

  Subject: [asp_web_howto] RE: Hiding data





  > You have to check the data before you write a <TR> to the browser.

  >

  > Dim aValue

  > aValue =3D objRS("FieldX") & ""

  > if aValue <> "" then

  >          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

  > end if

  >

  > I assign the value of objRS("FieldX") to a local variable called 

aValue. I

  > do this because it is faster to reference a local variable than to

  > reference the recordset,.

  > However, this should work just as well:

  >

  > if objRS("FieldX") <> "" then

  >          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

  > end if

  >

  > HtH

  >

  > Imar

  >

  >

  > At 11:18 AM 12/12/2000 +0100, you wrote:

  > >Thanx for all your replies,

  > >I understand that the select clause will show only the 

corresponding

  data,

  > >but in the case I want to use <TR> and <TD> tags to display each of 

all

  the

  > >cells of the DB that match my query,

  > >I will have to write something like the following :

  > >

  > >.........

  > >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

  > >........ and so on .

  > >

  > >So you understand that a row and column will be created in order to

  insert

  > >the FieldX into it.

  > >If, the FieldX cell into the DB is blank, the row and column will 

be

  created

  > >anyway, with nothing inside, and this will cause an unconvenient 

blank

  area

  > >because it shows to my visitors that my DB isn't complete.

  > >

  > >In my case, the reasons why into the DB, some cells may be missing, 

is

  > >simply because for example, I've got phone and fax numbers, and 

some

  people

  > >do not have fax numbers. Sometimes, the cells are empty simply 

because

  the

  > >data isn't available.

  > >And what I would like to do is not to show that an information is 

missing

  by

  > >avoiding blank spaces and so on.

  > >

  > >Thankx

  > >

  > >

  > >



  > >----- Original Message -----

  > >From: "Ken Schaefer" <ken@a...>

  > >To: "ASP Web HowTo" <asp_web_howto@p...>

  > >Sent: Tuesday, December 12, 2000 2:17 AM

  > >Subject: [asp_web_howto] RE: Hiding data

  > >

  > >

  > > > > > You have quite a few options.

  > > > > >

  > > > > > The first two that come to mind are:

  > > > > > 1. Add a "WHERE" in you SQL Statement

  > > > >

  > > > > but, this may result in some fields you were after being not

  returned.

  > > >

  > > > Thinking about this...AFAIK the WHERE clause can only be used to

  restrict

  > > > the number of records returned, it wont result in some fields 

being

  > > > missing...The SELECT clause determines which fields are 

retrieved.

  > > >

  > > > Cheers

  > > > Ken

  > > >

  > > >

  > > >

  > >

  >



  ---

  MaximumASP offers enhanced hosting solutions on the Windows 2000 

platform. Dedicated processor, RAM, and server resources provide 

dedicated server performance at virtual server prices. Commercial 

components provided; custom components allowed.




leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com













---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com








Message #16 by Imar Spaanjaars <Imar@S...> on Tue, 12 Dec 2000 16:42:01 +0100
If  cStr(objRS("Direction"))<>"" will cause a runtime error if

objRS("Direction") is NULL, so take care when you run code like this.



You better first check if it contains any data, before you convert it to

another datatype.





Imar







At 09:44 AM 12/12/2000 -0500, you wrote:

>

>

>If  cStr(objRS("Direction"))<>""  AND cstr(objRS("Circons"))<>"" Then

>Response.Write("<TR><TD><font size=3D""1"">Circonscription :<B><font

>size=3D""2""> " &

>objRS("Circons") & "</TD>" & _

>"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "&

 objRS("Direction")

>& "</TD></TR>")

>End if

>

>-Majid

>

>----- Original Message -----

>From: <mailto:ramliabdel@y...>ramliabdel

>To: <mailto:asp_web_howto@p...>ASP Web HowTo

>Sent: Tuesday, December 12, 2000 8:00 AM

>Subject: [asp_web_howto] RE: Hiding data

>

>Thanx for your helpful answers, guy,

>

>I do understand what I should do

>I can use if statement, but how can I apply it in a long codes

>

>Here are my codes

>Do I need a single if statement for each of the fields, if so how to

 include

>them within te following ? :

>

><%

>

>   Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

>   Set objRS =3D Server.CreateObject("ADODB.Recordset")

>   strDirector =3D Request.Form("director")

>   strCountry =3D Request.Form("Country")

>

>

>

>   strSQL =3D "SELECT * "

>   strSQL =3D strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON

 Ecole08.TableID =3D

>Donnees08.TableID "

>   strSQL =3D strSQL & "WHERE (Ecole08.Ville =3D '" & strDirector & "' AND

>Ecole08.Cat=E9gorie =3D'" & strCountry & "' OR Ecole08.Ville =3D '" &

 strDirector

>& "')"

>   strSQL =3D strSQL & "ORDER BY Ecole08.Ville"

>

>  objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

 adCmdText

>

>   If objRS.EOF Then

>Response.Write "<H3>error message: " & strDirector

>   Else

>Response.write "<H3> " & strDirector & "<BR></H3>" & _

>"<font size=3D""2"">T=E9l=E9phone de la Mairie : " & objRS("T=E9lMairie") &

 "<BR>" &

>_

>"<B> " & objRS("FaxMairie")

>

>do while not objRS.EOF

>

>   Response.Write "<table width=3D""95%"" border=3D""0"" cellspacing=3D""1"

"

>cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" align=3D""center"">"

 & _

>

>"<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " &

>objRS("Circons") & "</TD>" & _

>"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "&

 objRS("Direction")

>& "</TD></TR>" & _

>

>"<TR><TD><font size=3D""1""><BR>Coordonnateur ZEP : <font size=3D""1""><B>"

 &

>objRS("CoordonnateurZEP") & "</b><BR></TR>" & _

>

>"<TR><TD colspan=3D""2""><font size=3D""1""> Regroupement P=E9dagogique

 <font

>size=3D""2"">" & objRS("Ville1") & "  " & _

>"<font size=3D""2"">" & objRS("Ville2") & "  " & _

>"<font size=3D""2"">" & objRS("Ville3") & "</TD></TR>" & _

>

>"<TR><TD colspan=3D""2""> <font size=3D""1""> Assoc. Parents d'=E9l=E8ves :

 <font

>size=3D""2""> <B>" & objRS("Parent=E9lu") & "</b></TD></TR>" & _

>"<BR><IMG SRC=3D""educinfo_files/fil.gif"" width=3D""250""

>height=3D""1""><BR><BR></TABLE>" & _

>

>

>

>objRS.MoveNext

>loop

>   End If

>   objRS.Close

>   Set objRS =3D Nothing

>%>

>

>

>

>

>

>

>

>Thank you very much

>

>

>

>

>

>

>

>----- Original Message -----

>From: "Imar Spaanjaars" <<mailto:Imar@S...>Imar@S...>

>To: "ASP Web HowTo"

><<mailto:asp_web_howto@p...>asp_web_howto@p...>

>Sent: Tuesday, December 12, 2000 11:56 AM

>Subject: [asp_web_howto] RE: Hiding data

>

>

>

> > You have to check the data before you write a <TR> to the browser.

> >

> > Dim aValue

> > aValue =3D objRS("FieldX") & ""

> > if aValue <> "" then

> >          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

> > end if

> >

> > I assign the value of objRS("FieldX") to a local variable called aValue.

 I

> > do this because it is faster to reference a local variable than to

> > reference the recordset,.

> > However, this should work just as well:

> >

> > if objRS("FieldX") <> "" then

> >          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

> > end if

> >

> > HtH

> >

> > Imar

> >

> >

> > At 11:18 AM 12/12/2000 +0100, you wrote:

> > >Thanx for all your replies,

> > >I understand that the select clause will show only the corresponding

>data,

> > >but in the case I want to use <TR> and <TD> tags to display each of all

>the

> > >cells of the DB that match my query,

> > >I will have to write something like the following :

> > >

> > >.........

> > >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> > >........ and so on .

> > >

> > >So you understand that a row and column will be created in order to

>insert

> > >the FieldX into it.

> > >If, the FieldX cell into the DB is blank, the row and column will be

>created

> > >anyway, with nothing inside, and this will cause an unconvenient blank

>area

> > >because it shows to my visitors that my DB isn't complete.

> > >

> > >In my case, the reasons why into the DB, some cells may be missing, is

> > >simply because for example, I've got phone and fax numbers, and some

>people

> > >do not have fax numbers. Sometimes, the cells are empty simply because

>the

> > >data isn't available.

> > >And what I would like to do is not to show that an information is

 missing

>by

> > >avoiding blank spaces and so on.

> > >

> > >Thankx

> > >

> > >

> > >

>

> > >----- Original Message -----

> > >From: "Ken Schaefer"

 <<mailto:ken@a...>ken@a...>

> > >To: "ASP Web HowTo"

> <<mailto:asp_web_howto@p...>asp_web_howto@p...>

> > >Sent: Tuesday, December 12, 2000 2:17 AM

> > >Subject: [asp_web_howto] RE: Hiding data

> > >

> > >

> > > > > > You have quite a few options.

> > > > > >

> > > > > > The first two that come to mind are:

> > > > > > 1. Add a "WHERE" in you SQL Statement

> > > > >

> > > > > but, this may result in some fields you were after being not

>returned.

> > > >

> > > > Thinking about this...AFAIK the WHERE clause can only be used to

>restrict

> > > > the number of records returned, it wont result in some fields being

> > > > missing...The SELECT clause determines which fields are retrieved.

> > > >

> > > > Cheers

> > > > Ken

> > > >

> > > >

> > > >

> > >

> >

>



---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #17 by "Whitmore, Todd x78046" <WhitmorT@b...> on Tue, 12 Dec 2000 11:08:58 -0500
You can always coerce the value to a string using the ** & "" **

instead of

the CStr() function

For example:



	strValue = "" & objRS("Direction")

	if (len(strValue) = 0) Then

		...

	Else

		...

	End If



-----Original Message-----

From: Imar Spaanjaars [mailto:Imar@S...]

Sent: Tuesday, December 12, 2000 10:42 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Hiding data





If  cStr(objRS("Direction"))<>"" will cause a runtime error if

objRS("Direction") is NULL, so take care when you run code like this.



You better first check if it contains any data, before you convert it to

another datatype.





Imar



---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #18 by "Sertial, Sam" <2495XX2@a...> on Tue, 12 Dec 2000 09:11:28 -0500
YOU CAN USE:

IF is null rs("FirstName") then

	response.write " "

   else

	response.write<%=3Drs("firstname")%>

end if





-----Original Message-----

From: ramliabdel [mailto:ramliabdel@y...]

Sent: Tuesday, December 12, 2000 8:00 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Hiding data





Thanx for your helpful answers, guy,



I do understand what I should do

I can use if statement, but how can I apply it in a long codes



Here are my codes

Do I need a single if statement for each of the fields, if so how to 

include

them within te following ? :



<%



  Dim objCommand, objRS, strDirector, strCountry, strSQLCOUNT

  Set objRS =3D Server.CreateObject("ADODB.Recordset")

  strDirector =3D Request.Form("director")

  strCountry =3D Request.Form("Country")





  strSQL =3D "SELECT * "

  strSQL =3D strSQL & "FROM Ecole08 INNER JOIN Donnees08 ON 

Ecole08.TableID =3D

Donnees08.TableID "

  strSQL =3D strSQL & "WHERE (Ecole08.Ville =3D '" & strDirector & "' 

AND

Ecole08.Cat=E9gorie =3D'" & strCountry & "' OR Ecole08.Ville =3D '" & 

strDirector

& "')"

  strSQL =3D strSQL & "ORDER BY Ecole08.Ville"



 objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, 

adCmdText



  If objRS.EOF Then

Response.Write "<H3>error message: " & strDirector

  Else

Response.write "<H3> " & strDirector & "<BR></H3>" & _

"<font size=3D""2"">T=E9l=E9phone de la Mairie : " & 

objRS("T=E9lMairie") & "<BR>" &

_

"<B> " & objRS("FaxMairie")



do while not objRS.EOF



  Response.Write "<table width=3D""95%"" border=3D""0"" 

cellspacing=3D""1""

cellpadding=3D""0"" height=3D"""" bgcolor=3D""white"" 

align=3D""center"">" & _



"<TR><TD><font size=3D""1"">Circonscription :<B><font size=3D""2""> " &

objRS("Circons") & "</TD>" & _

"<TD><font size=3D""1"">Direction : <font size=3D""2""><B> "& 

objRS("Direction")

& "</TD></TR>" & _



"<TR><TD><font size=3D""1""><BR>Coordonnateur ZEP : <font 

size=3D""1""><B>" &

objRS("CoordonnateurZEP") & "</b><BR></TR>" & _



"<TR><TD colspan=3D""2""><font size=3D""1""> Regroupement P=E9dagogique 

<font

size=3D""2"">" & objRS("Ville1") & "  " & _

"<font size=3D""2"">" & objRS("Ville2") & "  " & _

"<font size=3D""2"">" & objRS("Ville3") & "</TD></TR>" & _



"<TR><TD colspan=3D""2""> <font size=3D""1""> Assoc. Parents 

d'=E9l=E8ves : <font

size=3D""2""> <B>" & objRS("Parent=E9lu") & "</b></TD></TR>" & _

"<BR><IMG SRC=3D""educinfo_files/fil.gif"" width=3D""250""

height=3D""1""><BR><BR></TABLE>" & _





objRS.MoveNext

loop

  End If

  objRS.Close

  Set objRS =3D Nothing

%>









Thank you very much









----- Original Message -----

From: "Imar Spaanjaars" <Imar@S...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, December 12, 2000 11:56 AM

Subject: [asp_web_howto] RE: Hiding data





> You have to check the data before you write a <TR> to the browser.

>

> Dim aValue

> aValue =3D objRS("FieldX") & ""

> if aValue <> "" then

>          Response.Write("<TR><TD>" & aValue & "</TD></TR>")

> end if

>

> I assign the value of objRS("FieldX") to a local variable called 

aValue. I

> do this because it is faster to reference a local variable than to

> reference the recordset,.

> However, this should work just as well:

>

> if objRS("FieldX") <> "" then

>          Response.Write("<TR><TD>" & objRS("FieldX") & "</TD></TR>")

> end if

>

> HtH

>

> Imar

>

>

> At 11:18 AM 12/12/2000 +0100, you wrote:

> >Thanx for all your replies,

> >I understand that the select clause will show only the corresponding

data,

> >but in the case I want to use <TR> and <TD> tags to display each of 

all

the

> >cells of the DB that match my query,

> >I will have to write something like the following :

> >

> >.........

> >"<TR><TD>" & objRS("FieldX") &</TD></TR>" & _

> >........ and so on .

> >

> >So you understand that a row and column will be created in order to

insert

> >the FieldX into it.

> >If, the FieldX cell into the DB is blank, the row and column will be

created

> >anyway, with nothing inside, and this will cause an unconvenient 

blank

area

> >because it shows to my visitors that my DB isn't complete.

> >

> >In my case, the reasons why into the DB, some cells may be missing, 

is

> >simply because for example, I've got phone and fax numbers, and some

people

> >do not have fax numbers. Sometimes, the cells are empty simply 

because

the

> >data isn't available.

> >And what I would like to do is not to show that an information is 

missing

by

> >avoiding blank spaces and so on.

> >

> >Thankx

> >

> >

> >



> >----- Original Message -----

> >From: "Ken Schaefer" <ken@a...>

> >To: "ASP Web HowTo" <asp_web_howto@p...>

> >Sent: Tuesday, December 12, 2000 2:17 AM

> >Subject: [asp_web_howto] RE: Hiding data

> >

> >

> > > > > You have quite a few options.

> > > > >

> > > > > The first two that come to mind are:

> > > > > 1. Add a "WHERE" in you SQL Statement

> > > >

> > > > but, this may result in some fields you were after being not

returned.

> > >

> > > Thinking about this...AFAIK the WHERE clause can only be used to

restrict

> > > the number of records returned, it wont result in some fields 

being

> > > missing...The SELECT clause determines which fields are 

retrieved.

> > >

> > > Cheers

> > > Ken

> > >

> > >

> > >

> >

>





---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index