oRs:Find

Post Reply
User avatar
Lisa Giordano
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

oRs:Find

Post by Lisa Giordano »

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

Re: oRs:Find

Post by nageswaragunupudi »

Sample code :

Code: Select all

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 )
Last edited by nageswaragunupudi on Wed Apr 15, 2009 3:19 pm, edited 1 time in total.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: oRs:Find

Post by Armando »

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
User avatar
Lisa Giordano
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Re: oRs:Find

Post by Lisa Giordano »

Reg restituisce sempre NIL
User avatar
Lisa Giordano
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Re: oRs:Find

Post by Lisa Giordano »

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
User avatar
Lisa Giordano
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Re: oRs:Find

Post by Lisa Giordano »

oRs:Sort :="CodTes"
da errore
Help me
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: oRs:Find

Post by Armando »

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

Re: oRs:Find

Post by nageswaragunupudi »

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