Page 1 of 1

Requery nativa Mr.Rao.

Posted: Sun Apr 25, 2021 5:07 pm
by Ariel
Mr. Rao,
hago un query, y el datarow es ! lreadonly, hago un requery y el que obtengo es lreadonly, por qué?

Saludos.

Re: Requery nativa Mr.Rao.

Posted: Mon Apr 26, 2021 12:24 pm
by Rick Lipkin
Ariel

It depends on how you setup the recordset ... This is the old fashioned way .. notice openkeyset

Code: Select all | Expand


cSQL := "SELECT * from USERINFO order by USERID"

oRsUSER := TOleAuto():New( "ADODB.Recordset" )    
oRsUSER:CursorType     := 1        // opendkeyset
oRsUSER:CursorLocation := 3        // local cache
oRsUSER:LockType       := 3        // lockoportunistic

TRY
   oRsUSER:Open( cSQL,xConnect )
CATCH oErr
   MsgInfo( "Error in Opening USERINFO table" )
   RETURN(.F.)
END TRY

 


Here is a good link
https://wiki.fivetechsoft.com/doku.php? ... ted_stuffs

Rick Lipkin

Re: Requery nativa Mr.Rao.

Posted: Mon Apr 26, 2021 3:39 pm
by Ariel
Rick,
gracias por contestar, pero uso fwh nativa directamente. Hago :

oSql:= oCon:Query( "SELECT * FROM articulos" )
? oSql:lreadonly --> .f.

Luego del :Requery() si lo edito :
oRec:= TDataRow():New( ::oSql )
? oRec:lReadonly, oRec:uSource:lReadOnly ---> .t., .t.

por que hace esto ???

Re: Requery nativa Mr.Rao.

Posted: Mon Apr 26, 2021 5:42 pm
by nageswaragunupudi
There should be no problem with a simple Requery() or Requery( {aparms} ) with params.
The problem is when Requery( cNewQuery ) is used with a totally different Sql query.

Please confirm.

Code: Select all | Expand

#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB()

   oRs   := oCn:RowSet( "select * from customer" )
   ? oRs:lReadOnly  // --> .f.
   oRs:Requery()
   ? oRs:lReadOnly // --> .f.
   oRs:Requery( "select * from states" ) // Here is the problem. Bug
   ? oRs:lReadOnly  // --> .t.                 // Should be .f. but it is .t.

   oRs:Close()
   oCn:Close()

return nil
 


We are sending you revised libs with the fix.

Re: Requery nativa Mr.Rao.

Posted: Mon Apr 26, 2021 6:43 pm
by Ariel
Mr. Rao,

exactamente la segunda opción es lo que me sucede, pero el query es el mismo solo que cambia el where, pero el llamado es :requery( cNewQuery )

Saludos.

Re: Requery nativa Mr.Rao. (SOLUCIONADO)

Posted: Mon Apr 26, 2021 6:49 pm
by Ariel
Mr. Rao,

gracias funciona perfectamente.

Saludos.