Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: How to insert [ ] if the field is [null]


Message #1 by achiu@m... on Fri, 28 Sep 2001 16:37:21
Hello everyone,



How to write the codes to insert a [ ] if the field is [null]. 

Following codes are used to retrieve field names and values from a sql 

server database, I have tried [If objField.value = "" then Response.Write 

(" ") End if] but this wont work. Any help or hint will be 

appreciated.



<% 

  dim objField

    if Request.Form("email") <> "" then

    Response.Write("<table border='1' bordercolor='#990033' 

cellpadding='5' cellspacing='0' bgcolor='#cccc99'><tr align='center'>")

	Response.Write("<tr>")

	For each objField in fdRS.Fields

	  Response.Write("<td><font face='arial, helvetica' size='2'><b>" 

& objField.Name & "</b></font></td>")

	Next

	  Response.Write("</tr>")

    Do while Not fdRS.EOF

	  Response.Write("<tr>")

	For each objField in fdRS.Fields

	  Response.Write("<td><font face='arial, helvetica' size='2'>" & 

objField.Value & "</font></td>")

	Next

	  Response.Write("</tr>")

	  fdRS.movenext

	Loop

	end if

%>



Alan
Message #2 by "phil griffiths" <pgtips@m...> on Fri, 28 Sep 2001 16:50:17
Use IsNull function - syntax:

If IsNull(objField.Value) then

   Response.Write(" ")

End If



> Hello everyone,

> 

> How to write the codes to insert a [ ] if the field is [null]. 

> Following codes are used to retrieve field names and values from a sql 

> server database, I have tried [If objField.value = "" then 

Response.Write 

> (" ") End if] but this wont work. Any help or hint will be 

> appreciated.

> 

> <% 

>   dim objField

>     if Request.Form("email") <> "" then

>     Response.Write("<table border='1' bordercolor='#990033' 

> cellpadding='5' cellspacing='0' bgcolor='#cccc99'><tr align='center'>")

> 	Response.Write("<tr>")

> 	For each objField in fdRS.Fields

> 	  Response.Write("<td><font face='arial, helvetica' size='2'><b>" 

> & objField.Name & "</b></font></td>")

> 	Next

> 	  Response.Write("</tr>")

>     Do while Not fdRS.EOF

> 	  Response.Write("<tr>")

> 	For each objField in fdRS.Fields

> 	  Response.Write("<td><font face='arial, helvetica' size='2'>" & 

> objField.Value & "</font></td>")

> 	Next

> 	  Response.Write("</tr>")

> 	  fdRS.movenext

> 	Loop

> 	end if

> %>

> 

> Alan
Message #3 by "Alan Chiu" <achiu@m...> on Fri, 28 Sep 2001 12:58:23 -0400
Phil,



Thank you.



Alan



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

From: phil griffiths [mailto:pgtips@m...]

Sent: Friday, September 28, 2001 4:50 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Re: How to insert [ ] if the field is

[null]





Use IsNull function - syntax:

If IsNull(objField.Value) then

   Response.Write(" ")

End If



> Hello everyone,

>

> How to write the codes to insert a [ ] if the field is [null].

> Following codes are used to retrieve field names and values from a sql

> server database, I have tried [If objField.value = "" then

Response.Write

> (" ") End if] but this wont work. Any help or hint will be

> appreciated.

>

> <%

>   dim objField

>     if Request.Form("email") <> "" then

>     Response.Write("<table border='1' bordercolor='#990033'

> cellpadding='5' cellspacing='0' bgcolor='#cccc99'><tr align='center'>")

> 	Response.Write("<tr>")

> 	For each objField in fdRS.Fields

> 	  Response.Write("<td><font face='arial, helvetica' size='2'><b>"

> & objField.Name & "</b></font></td>")

> 	Next

> 	  Response.Write("</tr>")

>     Do while Not fdRS.EOF

> 	  Response.Write("<tr>")

> 	For each objField in fdRS.Fields

> 	  Response.Write("<td><font face='arial, helvetica' size='2'>" &

> objField.Value & "</font></td>")

> 	Next

> 	  Response.Write("</tr>")

> 	  fdRS.movenext

> 	Loop

> 	end if

> %>

>

> Alan

  Return to Index