FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Requery nativa Mr.Rao.
Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
Requery nativa Mr.Rao.
Posted: Sun Apr 25, 2021 05:07 PM

Mr. Rao,
hago un query, y el datarow es ! lreadonly, hago un requery y el que obtengo es lreadonly, por qué?

Saludos.

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Requery nativa Mr.Rao.
Posted: Mon Apr 26, 2021 12:24 PM
Ariel

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

Code (fw): Select all Collapse
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
Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
Re: Requery nativa Mr.Rao.
Posted: Mon Apr 26, 2021 03:39 PM

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 ???

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Requery nativa Mr.Rao.
Posted: Mon Apr 26, 2021 05:42 PM
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 (fw): Select all Collapse
#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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
Re: Requery nativa Mr.Rao.
Posted: Mon Apr 26, 2021 06:43 PM

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.

Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
Re: Requery nativa Mr.Rao. (SOLUCIONADO)
Posted: Mon Apr 26, 2021 06:49 PM

Mr. Rao,

gracias funciona perfectamente.

Saludos.

Continue the discussion