oRs:Find

oRs:Find

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

Re: oRs:Find

Postby nageswaragunupudi » Wed Apr 15, 2009 3:08 pm

Sample code :
Code: Select all  Expand view

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

Re: oRs:Find

Postby Armando » Wed Apr 15, 2009 3: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
User avatar
Armando
 
Posts: 3211
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: oRs:Find

Postby Lisa Giordano » Thu Apr 16, 2009 4:35 pm

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

Re: oRs:Find

Postby Lisa Giordano » Thu Apr 16, 2009 4: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
User avatar
Lisa Giordano
 
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Re: oRs:Find

Postby Lisa Giordano » Thu Apr 16, 2009 4:59 pm

oRs:Sort :="CodTes"
da errore
Help me
User avatar
Lisa Giordano
 
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Re: oRs:Find

Postby Armando » Thu Apr 16, 2009 5: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
User avatar
Armando
 
Posts: 3211
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: oRs:Find

Postby nageswaragunupudi » Thu Apr 16, 2009 5: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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests