FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oRs:Find
Posts: 25
Joined: Wed Jul 09, 2008 05:56 PM
oRs:Find
Posted: Wed Apr 15, 2009 02:52 PM

Ciao a tutti,
ho provato questo codice per una ricerca in un file MDB:

     cFind:="K"
     oRs:MoveFirst()

     Reg:=oRs:Find("Campo1='"+cFind+"'")

     msginfo(Reg)

   oRs:Absoluteposition:=Reg

il valore restituito in Reg è uguale a nil
dove sbaglio?
Grazie

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oRs:Find
Posted: Wed Apr 15, 2009 03:08 PM
Sample code :
Code (fw): Select all Collapse
oRs:Find( cSeekExpr, 0, 1, 1)
if oRs:eof()
   lFound   := .F.
   oRs:MoveLast()
else
   lFound   := .T.
endif

oRs:Find always returns nil. If find is successful, it goes to the first row found. If not it goes to eof.

Syntax:
objRecordset:Find( criteria, skiprows, direction, start )
Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: oRs:Find
Posted: Wed Apr 15, 2009 03:12 PM

Lisa:

Try this way

Reg:=oRs:Find("Campo1= " + "'" + cFind + "'")

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: 25
Joined: Wed Jul 09, 2008 05:56 PM
Re: oRs:Find
Posted: Thu Apr 16, 2009 04:35 PM

Reg restituisce sempre NIL

Posts: 25
Joined: Wed Jul 09, 2008 05:56 PM
Re: oRs:Find
Posted: Thu Apr 16, 2009 04:53 PM

if !oRs:eof() la ricerca ha esito positivo...

nTessera:="0100141411283"
oRs:MoveFirst()

oRs:Find( "CODTES='"+nTessera+"'", 0, 1, 1)
if !oRs:eof()
msginfo(oRs:Fields("CodTes"):Value)
endif

Grazie del suggerimento

Posts: 25
Joined: Wed Jul 09, 2008 05:56 PM
Re: oRs:Find
Posted: Thu Apr 16, 2009 04:59 PM

oRs:Sort :="CodTes"
da errore
Help me

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: oRs:Find
Posted: Thu Apr 16, 2009 05:18 PM

Lisa:

Please review my spanish blog.

http://sqlcmd.blogspot.com/

All about ADO & MySql.

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: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oRs:Find
Posted: Thu Apr 16, 2009 05:20 PM

>
oRs:Sort :="CodTes"
>
This is correct. Please check your spellings and make sure the field name exists in the recordset.
what error are you getting ?

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion