Page 1 of 1

Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 4:59 pm
by ruben Dario
Saludos al forum

Como se clona un Objeto.

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 5:06 pm
by karinha
oNew := oClone( oObject )

Salu2

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 7:50 pm
by ruben Dario
Gracias karinha

Me da este error al ejecutar

__objcole -- Error de Argumento

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 8:26 pm
by karinha
Que intentas clonar, una ListBox?

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 8:32 pm
by ruben Dario
No
No se si es posible clonar esto
oQSet := TOleAuto():New( "ADODB.Recordset" )
...
oQSet:Open( "Select "+ cSelect +" from " + cTabla + " LIMIT 50" , oApp:StrConnection,1, 3 )

Intento clonar el oQSet no se si es posible,

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 8:45 pm
by karinha
ni jo.
mis desculpas.

salu2

Re: Como se Clona un Objeto

PostPosted: Thu Apr 11, 2013 9:22 pm
by Antonio Linares
Ruben,

Clonar un objeto que use determinados handles de Windows, memoria, buffers, etc., no tiene sentido. El resultado no serviría de nada, ó provocaría muchos errores.

Lo que puedes hacer es copiar los valores de las datas del objeto, pero el objeto en si, completo, no podria ser duplicado y uno provocaria errores en el otro.

Re: Como se Clona un Objeto

PostPosted: Fri Apr 12, 2013 1:20 pm
by nageswaragunupudi
ruben Dario wrote:No
No se si es posible clonar esto
oQSet := TOleAuto():New( "ADODB.Recordset" )
...
oQSet:Open( "Select "+ cSelect +" from " + cTabla + " LIMIT 50" , oApp:StrConnection,1, 3 )

Intento clonar el oQSet no se si es posible,

RecordSet has a Clone method in ADO.

oRs2 := oRs:Clone()

oRs2 has all the filter, sort, record position at the time of cloning.
For all subsequent operations, the two recordsets are in independent.

Re: Como se Clona un Objeto

PostPosted: Fri Apr 12, 2013 3:38 pm
by ruben Dario
Muchas Gracias

Por su aporte y alcaracion

Re: Como se Clona un Objeto

PostPosted: Wed Apr 08, 2020 2:40 pm
by MOISES
No, it is not.

When you clone a Recordset you actually just create a new pointer to the same Recordset, therefore any changes you make to one Recordset will be visible in all of its clones. However, if you execute a Requery on the original Recordset, the clones will no longer be synchronized to the original.

The provider must support bookmarks on the Recordset object to create clones. Bookmarks are interchangeable; a bookmark reference from one Recordset object refers to the same record in any of its clones.

Note: The filter of the original Recordset will not be applied to the clone. To copy an existing filter: objRecordsetNew.Filter=objRecordsetOriginal.Filter