FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse ADO
Posts: 43
Joined: Wed Jun 20, 2012 04:07 AM
Xbrowse ADO
Posted: Tue Oct 28, 2014 06:00 AM

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.

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Xbrowse ADO
Posted: Tue Oct 28, 2014 01:21 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse ADO
Posted: Tue Oct 28, 2014 03:05 PM

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 )

Regards



G. N. Rao.

Hyderabad, India
Posts: 43
Joined: Wed Jun 20, 2012 04:07 AM
Re: Xbrowse ADO
Posted: Wed Oct 29, 2014 05:58 AM

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

Continue the discussion