How to Null a date in Sql Fivewin/Harbour

How to Null a date in Sql Fivewin/Harbour

Postby byron.hopp » Sat Feb 20, 2016 9: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
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: How to Null a date in Sql Fivewin/Harbour

Postby nageswaragunupudi » Sun Feb 21, 2016 5: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to Null a date in Sql Fivewin/Harbour

Postby Armando » Sun Feb 21, 2016 5: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
User avatar
Armando
 
Posts: 3209
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: How to Null a date in Sql Fivewin/Harbour

Postby Rick Lipkin » Sun Feb 21, 2016 9:32 pm

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

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2664
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 71 guests