Xbrowse ADO

Post Reply
brewster
Posts: 43
Joined: Wed Jun 20, 2012 4:07 am

Xbrowse ADO

Post 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.
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Xbrowse ADO

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Xbrowse ADO

Post 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 )
Regards

G. N. Rao.
Hyderabad, India
brewster
Posts: 43
Joined: Wed Jun 20, 2012 4:07 am

Re: Xbrowse ADO

Post 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
Post Reply