Page 1 of 1

Xbrowse ADO

Posted: Tue Oct 28, 2014 6:00 am
by brewster
Currently I am using a simple calendar that when double clicking on a day, I would like it to open an Xbrowse and reveal messages for that day.

I am passing the selected day to my Xbrowse RecDate(cal_dte) function but am unable to get oRs:find() to recognize the passed var (dCal_dte).

As the excerpt shows by assigning any date, everything works , OK ,but the syntax to utilize the passed var is lacking.

The .dbf field format is Date 10 .


What is the proper form for the find() to achieve this ?


Here is an excerpt from that function :
>>>>>>>>
func RecDate(cal_dte) // Date : 10/17/14
// Update : 10/17/14
// Purpose : Use ADO with a message .dbf

local dCal_dte := cal_dte

local oCn, oRs
local oWnd, oFont, oBrw, oMiSort

local oDlg

local oErr

SET DATE AMERICAN
SET CENTURY ON

oCn := FW_OpenAdoConnection( cPath_seg )
oRs := FW_OpenRecordSet( oCn, "CAL_REC" )

oRs:sort:= 'CAL_DTE'
oRs:MoveFirst()

try
oRs:find("CAL_DTE = 10/21/2014") // works OK , if exact date is in the .dbf
//oRs:find("CAL_DTE = dCal_dte") // does not work, syntax problem ??, I've tried variations,but obviously not the correct one ???
oRs:Update()

catch oErr
MsginFo( "no messages for that date " )
return oWnd
End try

>>>>>>>>>>>
FWH 14.08
Harbour 3.2.0dev
Bcc 582

Thanks,
Bruce S.

Re: Xbrowse ADO

Posted: Tue Oct 28, 2014 1:21 pm
by Rick Lipkin
Brewster

1) Are you sure your date dCal_dte is truly valtype "D" ?
2) Try it with Set Century On at the top of your program and Set Epoch to ( 1995 )

I see that you are using Harbour, with xHarbour ADO values for DateTime are ValType "T" and you have to substr() out the time and convert to ctod().

Rick Lipkin

Re: Xbrowse ADO

Posted: Tue Oct 28, 2014 3:05 pm
by nageswaragunupudi
oRs:find("CAL_DTE = dCal_dte") does not work.
Because ADO can not understan what is thist "dCal_dte".
Please use:
oRs:Find( "CAL_DTE = " + FW_DateToADO( dCal_dte ), 0, 1, 1 )

Re: Xbrowse ADO

Posted: Wed Oct 29, 2014 5:58 am
by brewster
Mr. Nages,
The FW_DateToADO proved to be the solution.


Mr. Rick
Appreciate your thoughts. Your " ADO-related stuffs " article is what "broke the ice " for me to try ADO.
Much learned and much yet to be learned.

Many thanks to all,
Bruce S