FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Write NULL value
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Write NULL value
Posted: Wed Jun 23, 2021 03:14 PM
Hello Friends.

In a MySQL table I have a date type field that accepts null value,
when registering the record a date type value is saved in this field,
example 20210623, now how can I re-record NULL ?

BTW, I write all fields with this source code

Code (fw): Select all Collapse
STATIC FUNCTION Upgrade(oRsHdr)
   IF lAddD02
      oRsD02:AddNew()
      oRsD02:Fields("D02_NUMPRO"):Value   := oRsHdr:Fields("HDR_PRO"):Value
   ENDIF
   oRsD02:Fields("D02_FECVIS"):Value := oD02:FECVIS    // Fecha de la visita
   oRsD02:UpDate()


I tried with
Code (fw): Select all Collapse
   oRsD02:Fields("D02_FECVIS"):Value := NULL or NIL  // Fecha de la visita


But it does not work

I know that with the INSERT command it is possible but there are
more than 50 tables, one prg for each table, and each table has
more than 100 fields

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Write NULL value
Posted: Wed Jun 23, 2021 05:22 PM
Use FWH function AdoNull()
Code (fw): Select all Collapse
oRs:Fields( "datefield" ):Value := AdoNull()

This works.

When a NULL value is read, oRs:Fields( xx ):Value returns NIL.
But assigning NIL does not work. Assigning AdoNull() and then calling oRs:Update() works.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Write NULL value
Posted: Wed Jun 23, 2021 05:58 PM

Mr. Rao:

Thank you very much, It Works fine.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion