Mr. Rao. REQUERY FWH Nativa.

Post Reply
Ariel
Posts: 309
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Mr. Rao. REQUERY FWH Nativa.

Post by Ariel »

buenas,

tengo un select id,nombre,direccion, cuando lo edito en el xbrowse, quiero editar TODOS _ de la tabla (son 30 por ejemplo), como hago para traer todos _ ?
intente :

cStr:= ""
aEval( ::oConn:ListColumns("clientes"), {| o | cStr += If( Empty( cStr ), "", "," )+AllTrim( o[1] ) } )

::oCliente:= ::oQuery:Record( cStr ) // Devuelve el registro señalado en el Browse
// ::oQryP:Source = cQuery de Dolphin
if ValType( ::oCliente ) == "O"
//if ::oCliente <> nil
? ::oCliente:Apellido, ::oCliente:Nombre, ::oCliente:direccion
end

pero solo me trae los de la consulta inicial

Gracias.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Mr. Rao. REQUERY FWH Nativa.

Post by nageswaragunupudi »

With FWH builtin mysql/mariadb library, use the method

Code: Select all

EditBaseRecord( [cFieldList], [lNew], [bEdit], [oBrw], [lLock] )
 
This method reads all fields from the database and offers for edit. When saved, the rowset in the memory is updated.

Notes:
1) The table must have a primary key.
2) The query should include the primary key.

Sample code:

Code: Select all

#include "fivewin.ch"

function Main()

   local oCn
   local oRs, oDlg, oFont, oBrw, oBar, bEdit

   oCn   := FW_DemoDB()

   oRs   := oCn:RowSet( "select id, first, city, salary from customer" )
            // The table SHOULD have a primary key.
            // The query SHOULD include the primary key.


// bEdit := { |oRec| MyEditDialog( oRec ) }
// In your program, you design your own dialog

   XBROWSER oRs

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,600 PIXEL TRUEPIXEL FONT oFont

   DEFINE BUTTONBAR oBar SIZE 80,32 2010
   DEFINE BUTTON OF oBar PROMPT "New"  ACTION oRs:EditBaseRecord( nil, .t., bEdit, oBrw )
   DEFINE BUTTON OF oBar PROMPT "Edit" ACTION oRs:EditBaseRecord( nil, .f., bEdit, oBrw )

   @ oBar:nHeight, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   oCn:Close()

return nil
 
You may test this first and then apply to your table
Regards

G. N. Rao.
Hyderabad, India
Post Reply