How to read null database value in ASP?

Results 1 to 2 of 2

Thread: How to read null database value in ASP?

  1. #1
    Barb Guest

    Default How to read null database value in ASP?

    I have figured out that a null value returned in a recordset is not the same as a null value in VBScript/ASP. I activate a SELECT statement that gives back a recordset where one field may be null. I save the values that come back, and then determine if the user wants to change any of them, and overlay the recordset value where applicable. Finally I call a stored procedure in Oracle to update the record w/ all of the fields.<BR><BR>It&#039s all beautiful if the value in the field that can be null has text in it, but it does not return anything to ASP if it is null. I have tried checking the returned value for null, "", Len(field) &#060; 1, and Len(field) &#060; 1 OR Len(field) &#062; 255. The lengths come back as nothing...not 0, not some bizarre number...nothing.<BR><BR>SO, how do I get around this? Is there a way I can ask whether or not the db returned a null value and have ASP understand it?<BR><BR>Thanks!<BR><BR>Here&#039s an example of the call:<BR>&#039i_Font, i_IndexPage are being altered. i_Bus_Ctc_Ky is the primary key for the recordset. i_IndexPage is the field that can, and often is, null.<BR><BR>Sub TestUpdGoResAplPrp<BR> i_Font = "Courier New"<BR> i_FontSize = ""<BR>&#039 i_IndexPage = ""<BR> i_IndexPage = ""<BR> i_Bus_Ctc_Ky = "513637" &#039KXSJCAO<BR> <BR> Set RecObj = Server.CreateObject("ADODB.Recordset")<BR> If i_Font &#060;&#062; "" OR i_FontSize &#060;&#062; "" OR i_IndexPage &#060;&#062; "" then<BR> &#039Get current data from GO RES Application Properties Table (from Oracle DB)<BR> sSQLStmt = "SELECT * FROM GO_RES_APL_PRP Where Bus_Ctc_Ky = &#039" & i_Bus_Ctc_Ky & "&#039<BR> RecObj.Open sSQLStmt, Application("gdbORCConn_ConnectionString"), adOpenStatic, adLockReadOnly, adCmdText<BR><BR> Font = RecObj.Fields("Scn_Fnt_Nm")<BR> FontSize = RecObj.Fields("FNT_SIZ")<BR>&#039RIGHT HERE is where RecObj.Fields("IDX_PGE_ID") is null in the database but has been returned as nothing.<BR><BR> If Len(RecObj.Fields("IDX_PGE_ID")) &#060; 1 OR Len(RecObj.Fields("IDX_PGE_ID")) &#062; 255 Then<BR> rsIndexPage = ""<BR> Else<BR> rsIndexPage = RecObj.Fields("IDX_PGE_ID")<BR> End if<BR> <BR> &#039Update with input parameters where present.<BR> If i_Font &#060;&#062; "" Then <BR> Font = i_Font<BR> End if<BR> If i_FontSize &#060;&#062; "" Then<BR> FontSize = i_FontSize<BR> End if<BR> If i_IndexPage &#060;&#062; "" Then<BR> IndexPage = i_IndexPage<BR> Else <BR> IndexPage = rsIndexPage<BR> End if<BR><BR> RecObj.Close <BR> Set RecObj = Nothing<BR><BR> Response.Write "Contact Key = " & i_Bus_Ctc_Ky "<BR> Response.Write "Font = " & Font Response.Write "Font Size = " & FontSize Response.Write "Index Page = *" & IndexPage & "*"<BR><BR> &#039Now, resend field values to stored procedure for update.<BR> UpdGoResAplPrp i_Bus_Ctc_Ky, Font, FontSize, IndexPage, ErrorCode<BR><BR>End sub

  2. #2
    Join Date
    Dec 1969

    Default RE: How to read null database value in ASP?

    yes,<BR><BR>IF ISNULL(database_value_here) THEN<BR><BR>END IF

Posting Permissions

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