error Handling null fields

Results 1 to 3 of 3

Thread: error Handling null fields

  1. #1
    Join Date
    Dec 1969

    Default error Handling null fields

    I am trying to detect if the field "code1" in access DB is empty or not. Below is my code. But even if the field is empty it wont show it. <BR>what would be the problem? code1 is a text field<BR> &#060;!-- #INCLUDE fILE=""--&#062;<BR>&#060;% <BR>Set MyCon2=Server.CreateObject("ADODB.Connection")<BR> dsn= "NAUTILUStest"<BR> "nautilustest"<BR>Set rss1 = Server.CreateObject( "ADODB.Recordset" )<BR>rss1.ActiveConnection = MyCon2<BR>rss1.LockType =1<BR>rss1.cursorType=3<BR>rss1.Open "SELECT * FROM formsubmit "<BR>Do While Not RSS1.eof<BR> response.write ("herer")<BR> If RSS1("code1")="" Then<BR> response.write ("It is empty")<BR> rss1.movenext<BR> End If<BR>Loop <BR><BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: error Handling null fields

    If RSS1("code1")& ""="" Then

  3. #3
    Join Date
    Dec 1969

    Default Teaching time..

    The reason is that a null is not the same as a zero-length string.<BR><BR>So, this is not true:<BR>null = ""<BR><BR>In fact, null, is a strange beast in that it doesn&#039;t "equal" itself. So, this also, is not true:<BR>null = null<BR><BR>However, VBScript will convert null values to zero-length strings when you concatenate a null to a string. So, WK&#039;s code is basically saying:<BR>null & "" = ""<BR><BR>Which becomes:<BR>"" = ""<BR><BR>Which can evaluate to True.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts