FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to Null a date in Sql Fivewin/Harbour
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
How to Null a date in Sql Fivewin/Harbour
Posted: Sat Feb 20, 2016 09:08 PM

Does anybody know how to save a null value back to a ADO recordset in a fivewin app.

oRs:Fields("MyDateTime"):Value := null //does not work

oConn:Execute( "update MyTable set MyDateTime=null where keyno=123" )

The sql command works but because I am using it inside a column browse there is a lot of work related to re-syncing the recordset and re-displaying within the browse.

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to Null a date in Sql Fivewin/Harbour
Posted: Sun Feb 21, 2016 05:50 AM

oRs:Fields("AnyField"):Value := AdoNull() // works for any field type, if the field is nullable.
This works in all cases.

AdoNull() is FWH function.

For DateTime fields assigning NIL or CTOD("") also may work in many cases.

Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: How to Null a date in Sql Fivewin/Harbour
Posted: Sun Feb 21, 2016 05:25 PM

byron.hopp

Try with NIL instead NULL value

oRs:Fields("MyDateTime"):Value := NIL

Obviously, the field must be defined for accept null value

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: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: How to Null a date in Sql Fivewin/Harbour
Posted: Sun Feb 21, 2016 09:32 PM

As Rao mentions .. ctod("") seems to work for both Ms Access and MS Sql Server.

Rick Lipkin

Continue the discussion