Page 1 of 1

oRs:Find

Posted: Wed Apr 15, 2009 2:52 pm
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

Re: oRs:Find

Posted: Wed Apr 15, 2009 3:08 pm
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 )

Re: oRs:Find

Posted: Wed Apr 15, 2009 3:12 pm
by Armando
Lisa:

Try this way

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

Regards

Re: oRs:Find

Posted: Thu Apr 16, 2009 4:35 pm
by Lisa Giordano
Reg restituisce sempre NIL

Re: oRs:Find

Posted: Thu Apr 16, 2009 4:53 pm
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

Re: oRs:Find

Posted: Thu Apr 16, 2009 4:59 pm
by Lisa Giordano
oRs:Sort :="CodTes"
da errore
Help me

Re: oRs:Find

Posted: Thu Apr 16, 2009 5:18 pm
by Armando
Lisa:

Please review my spanish blog.

http://sqlcmd.blogspot.com/

All about ADO & MySql.

Regards

Re: oRs:Find

Posted: Thu Apr 16, 2009 5:20 pm
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 ?