In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TSQLQuery

SQL databases
Responder
miguel
Mensajes: 364
Registrado: Jue Jul 02, 2009 1:09 pm

TSQLQuery

Mensaje por miguel »

Hola,
Siendo ::oAdoCDT un DataSource que ataca a SQLServer
WITH OBJECT ::oSQL := TSQLQuery():New( Self )
:oDataSource := ::oAdoCdt
:cProcess := "GENERAL"
:nCursorLocation := adUseServer
:nCursorType := adOpenForwardOnly
:cSelect := "SELECT * FROM TABLA"
:OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
:OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
:Create()
END
¿Estas dos lineas que se supone que retornan?
::oSQL:Recno()
::oSQL:RecCount()
Gracias.
Saludos. Miguel A. Torrellas
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9250
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TSQLQuery

Mensaje por ignacio »

Miguel,
Seguramente generen un error ya que ese tipo de cursor no soporta ni recuperación de Bookmark ni tampoco RecordCount.
Un saludo
Bookmark Property
Indicates a bookmark that uniquely identifies the current record in a Recordset object or sets the current record in a Recordset object to the record identified by a valid bookmark.
Settings and Return Values
Sets or returns a Variant expression that evaluates to a valid bookmark.
Remarks
Use the Bookmark property to save the position of the current record and return to that record at any time. Bookmarks are available only in Recordset objects that support bookmark functionality.
When you open a Recordset object, each of its records has a unique bookmark. To save the bookmark for the current record, assign the value of the Bookmark property to a variable. To quickly return to that record at any time after moving to a different record, set the Recordset object's Bookmark property to the value of that variable.
The user may not be able to view the value of the bookmark. Also, users should not expect bookmarks to be directly comparable-two bookmarks that refer to the same record may have different values.
If you use the Clone method to create a copy of a Recordset object, the Bookmark property settings for the original and the duplicate Recordset objects are identical and you can use them interchangeably. However, you cannot use bookmarks from different Recordset objects interchangeably, even if they were created from the same source or command.
Remote Data Service Usage When used on a client-side Recordset object, the Bookmark property is always available.
RecordCount Property
Indicates the number of records in a Recordset object.
Return Value
Returns a Long value that indicates the number of records in the Recordset.
Remarks
Use the RecordCount property to find out how many records are in a Recordset object. The property returns -1 when ADO cannot determine the number of records or if the provider or cursor type does not support RecordCount. Reading the RecordCount property on a closed Recordset causes an error.
If the Recordset object supports approximate positioning or bookmarks-that is, Supports (adApproxPosition) or Supports (adBookmark), respectively, return True-this value will be the exact number of records in the Recordset, regardless of whether it has been fully populated. If the Recordset object does not support approximate positioning, this property may be a significant drain on resources because all records will have to be retrieved and counted to return an accurate RecordCount value.
NOTE: In ADO versions 2.8 and earlier, the SQLOLEDB provider fetches all records when a server-side cursor is used despite the fact that it returns True for both Supports (adApproxPosition) and Supports (adBookmark),
The cursor type of the Recordset object affects whether the number of records can be determined. The RecordCount property will return -1 for a forward-only cursor; the actual count for a static or keyset cursor; and either -1 or the actual count for a dynamic cursor, depending on the data source.
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hola,
>
> Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>
> WITH OBJECT ::oSQL := TSQLQuery():New( Self )
> :oDataSource := ::oAdoCdt
> :cProcess := "GENERAL"
> :nCursorLocation := adUseServer
> :nCursorType := adOpenForwardOnly
> :cSelect := "SELECT * FROM TABLA"
> :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
> :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
> :Create()
> END
>
> ¿Estas dos lineas que se supone que retornan?
> ::oSQL:Recno()
> ::oSQL:RecCount()
>
>
> Gracias.
>
> Saludos. Miguel A. Torrellas
--
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
miguel
Mensajes: 364
Registrado: Jue Jul 02, 2009 1:09 pm

TSQLQuery

Mensaje por miguel »

Gracias Ignacio, lo sospechaba
La idea era utilizar TProgressbar, estoy buscando funciones de SQL
Server para incorporar el dato al SELECT, de momento no las encuentro,
si me puedes ayudar quedaré agradecido.
Saludos de nuevo.
Ignacio Ortiz de Zúñiga escribió:
> Miguel,
>
> Seguramente generen un error ya que ese tipo de cursor no soporta ni
> recuperación de Bookmark ni tampoco RecordCount.
>
> Un saludo
>
>
>
> Bookmark Property
>
> Indicates a bookmark that uniquely identifies the current record in a
> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
> object or sets the current record in a *Recordset* object to the record
> identified by a valid bookmark.
>
>
> Settings and Return Values
>
> Sets or returns a *Variant* expression that evaluates to a valid bookmark.
>
>
> Remarks
>
> Use the *Bookmark* property to save the position of the current record
> and return to that record at any time. Bookmarks are available only in
> *Recordset* objects that support bookmark functionality.
>
> When you open a *Recordset* object, each of its records has a unique
> bookmark. To save the bookmark for the current record, assign the value
> of the *Bookmark* property to a variable. To quickly return to that
> record at any time after moving to a different record, set the
> *Recordset* object's *Bookmark* property to the value of that variable.
>
> The user may not be able to view the value of the bookmark. Also, users
> should not expect bookmarks to be directly comparable—two bookmarks that
> refer to the same record may have different values.
>
> If you use the Clone
> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
> create a copy of a *Recordset* object, the *Bookmark* property settings
> for the original and the duplicate *Recordset* objects are identical and
> you can use them interchangeably. However, you cannot use bookmarks from
> different *Recordset* objects interchangeably, even if they were created
> from the same source or command.
>
> *Remote Data Service Usage *When used on a client-side *Recordset*
> object, the *Bookmark* property is always available.
>
>
> RecordCount Property
>
> Indicates the number of records in a Recordset
> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>
>
> Return Value
>
> Returns a *Long* value that indicates the number of records in the
> *Recordset*.
>
>
> Remarks
>
> Use the *RecordCount* property to find out how many records are in a
> *Recordset* object. The property returns -1 when ADO cannot determine
> the number of records or if the provider or cursor
> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
> type does not support *RecordCount*. Reading the *RecordCount* property
> on a closed *Recordset* causes an error.
>
> If the *Recordset* object supports approximate positioning or
> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
> (adBookmark)*, respectively, return *True*—this value will be the exact
> number of records in the *Recordset*, regardless of whether it has been
> fully populated. If the *Recordset* object does not support approximate
> positioning, this property may be a significant drain on resources
> because all records will have to be retrieved and counted to return an
> accurate *RecordCount* value.
>
> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider fetches
> all records when a server-side cursor is used despite the fact that it
> returns *True* for both *Supports (adApproxPosition)* and *Supports
> (adBookmark)*,
>
> The cursor type of the *Recordset* object affects whether the number of
> records can be determined. The *RecordCount* property will return -1 for
> a forward-only cursor; the actual count for a static or keyset cursor;
> and either -1 or the actual count for a dynamic cursor, depending on the
> data source.
>
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Miguel A. Torrellas" <miguel@torrellas.net
> <mailto:miguel@torrellas.net>> escribió en el mensaje
> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> > Hola,
> >
> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
> >
> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
> > :oDataSource := ::oAdoCdt
> > :cProcess := "GENERAL"
> > :nCursorLocation := adUseServer
> > :nCursorType := adOpenForwardOnly
> > :cSelect := "SELECT * FROM TABLA"
> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
> > :Create()
> > END
> >
> > ¿Estas dos lineas que se supone que retornan?
> > ::oSQL:Recno()
> > ::oSQL:RecCount()
> >
> >
> > Gracias.
> >
> > Saludos. Miguel A. Torrellas
jose.luis
Mensajes: 1633
Registrado: Vie Oct 14, 2005 10:56 pm

TSQLQuery

Mensaje por jose.luis »

Miguel,
So pena de penalizar el rendimiento, prueba a utilizar un cursor cliente.
Saludos,
José Luis Capel
"Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
> Gracias Ignacio, lo sospechaba
>
> La idea era utilizar TProgressbar, estoy buscando funciones de SQL Server
> para incorporar el dato al SELECT, de momento no las encuentro, si me
> puedes ayudar quedaré agradecido.
>
> Saludos de nuevo.
>
> Ignacio Ortiz de Zúñiga escribió:
>> Miguel,
>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>> recuperación de Bookmark ni tampoco RecordCount.
>> Un saludo
>> Bookmark Property
>>
>> Indicates a bookmark that uniquely identifies the current record in a
>> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>> object or sets the current record in a *Recordset* object to the record
>> identified by a valid bookmark.
>>
>>
>> Settings and Return Values
>>
>> Sets or returns a *Variant* expression that evaluates to a valid
>> bookmark.
>>
>>
>> Remarks
>>
>> Use the *Bookmark* property to save the position of the current record
>> and return to that record at any time. Bookmarks are available only in
>> *Recordset* objects that support bookmark functionality.
>>
>> When you open a *Recordset* object, each of its records has a unique
>> bookmark. To save the bookmark for the current record, assign the value
>> of the *Bookmark* property to a variable. To quickly return to that
>> record at any time after moving to a different record, set the
>> *Recordset* object's *Bookmark* property to the value of that variable.
>>
>> The user may not be able to view the value of the bookmark. Also, users
>> should not expect bookmarks to be directly comparable—two bookmarks that
>> refer to the same record may have different values.
>>
>> If you use the Clone
>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
>> create a copy of a *Recordset* object, the *Bookmark* property settings
>> for the original and the duplicate *Recordset* objects are identical and
>> you can use them interchangeably. However, you cannot use bookmarks from
>> different *Recordset* objects interchangeably, even if they were created
>> from the same source or command.
>>
>> *Remote Data Service Usage *When used on a client-side *Recordset*
>> object, the *Bookmark* property is always available.
>>
>>
>> RecordCount Property
>>
>> Indicates the number of records in a Recordset
>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>
>>
>> Return Value
>>
>> Returns a *Long* value that indicates the number of records in the
>> *Recordset*.
>>
>>
>> Remarks
>>
>> Use the *RecordCount* property to find out how many records are in a
>> *Recordset* object. The property returns -1 when ADO cannot determine the
>> number of records or if the provider or cursor
>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>> type does not support *RecordCount*. Reading the *RecordCount* property
>> on a closed *Recordset* causes an error.
>>
>> If the *Recordset* object supports approximate positioning or
>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>> (adBookmark)*, respectively, return *True*—this value will be the exact
>> number of records in the *Recordset*, regardless of whether it has been
>> fully populated. If the *Recordset* object does not support approximate
>> positioning, this property may be a significant drain on resources
>> because all records will have to be retrieved and counted to return an
>> accurate *RecordCount* value.
>>
>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider fetches
>> all records when a server-side cursor is used despite the fact that it
>> returns *True* for both *Supports (adApproxPosition)* and *Supports
>> (adBookmark)*,
>>
>> The cursor type of the *Recordset* object affects whether the number of
>> records can be determined. The *RecordCount* property will return -1 for
>> a forward-only cursor; the actual count for a static or keyset cursor;
>> and either -1 or the actual count for a dynamic cursor, depending on the
>> data source.
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> http://www.xailer.com
>> "Miguel A. Torrellas" <miguel@torrellas.net
>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> > Hola,
>> >
>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>> >
>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>> > :oDataSource := ::oAdoCdt
>> > :cProcess := "GENERAL"
>> > :nCursorLocation := adUseServer
>> > :nCursorType := adOpenForwardOnly
>> > :cSelect := "SELECT * FROM TABLA"
>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>> > :Create()
>> > END
>> >
>> > ¿Estas dos lineas que se supone que retornan?
>> > ::oSQL:Recno()
>> > ::oSQL:RecCount()
>> >
>> >
>> > Gracias.
>> >
>> > Saludos. Miguel A. Torrellas
miguel
Mensajes: 364
Registrado: Jue Jul 02, 2009 1:09 pm

TSQLQuery

Mensaje por miguel »

Gracias Jose Luis.
He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
filas, claro, en cursor cliente, el hecho de abrirla con acceso remoto,
pues eso, sin comentarios. Con la configuración del cursor como la he
puesto, los accesos son mas que aceptables, solo me faltaria saber como
introducir el dato en el SELECT para poder enviarlo al TProgressbar.
Saludos. Miguel A. Torrellas
José Luis Capel - Aicom escribió:
> Miguel,
>
> So pena de penalizar el rendimiento, prueba a utilizar un cursor cliente.
>
> Saludos,
> José Luis Capel
>
> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>> Gracias Ignacio, lo sospechaba
>>
>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL Server
>> para incorporar el dato al SELECT, de momento no las encuentro, si me
>> puedes ayudar quedaré agradecido.
>>
>> Saludos de nuevo.
>>
>> Ignacio Ortiz de Zúñiga escribió:
>>> Miguel,
>>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>>> recuperación de Bookmark ni tampoco RecordCount.
>>> Un saludo
>>> Bookmark Property
>>>
>>> Indicates a bookmark that uniquely identifies the current record in a
>>> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>> object or sets the current record in a *Recordset* object to the record
>>> identified by a valid bookmark.
>>>
>>>
>>> Settings and Return Values
>>>
>>> Sets or returns a *Variant* expression that evaluates to a valid
>>> bookmark.
>>>
>>>
>>> Remarks
>>>
>>> Use the *Bookmark* property to save the position of the current record
>>> and return to that record at any time. Bookmarks are available only in
>>> *Recordset* objects that support bookmark functionality.
>>>
>>> When you open a *Recordset* object, each of its records has a unique
>>> bookmark. To save the bookmark for the current record, assign the value
>>> of the *Bookmark* property to a variable. To quickly return to that
>>> record at any time after moving to a different record, set the
>>> *Recordset* object's *Bookmark* property to the value of that variable.
>>>
>>> The user may not be able to view the value of the bookmark. Also, users
>>> should not expect bookmarks to be directly comparable—two bookmarks that
>>> refer to the same record may have different values.
>>>
>>> If you use the Clone
>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
>>> create a copy of a *Recordset* object, the *Bookmark* property settings
>>> for the original and the duplicate *Recordset* objects are identical and
>>> you can use them interchangeably. However, you cannot use bookmarks from
>>> different *Recordset* objects interchangeably, even if they were created
>>> from the same source or command.
>>>
>>> *Remote Data Service Usage *When used on a client-side *Recordset*
>>> object, the *Bookmark* property is always available.
>>>
>>>
>>> RecordCount Property
>>>
>>> Indicates the number of records in a Recordset
>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>>
>>>
>>> Return Value
>>>
>>> Returns a *Long* value that indicates the number of records in the
>>> *Recordset*.
>>>
>>>
>>> Remarks
>>>
>>> Use the *RecordCount* property to find out how many records are in a
>>> *Recordset* object. The property returns -1 when ADO cannot determine the
>>> number of records or if the provider or cursor
>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>> type does not support *RecordCount*. Reading the *RecordCount* property
>>> on a closed *Recordset* causes an error.
>>>
>>> If the *Recordset* object supports approximate positioning or
>>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>>> (adBookmark)*, respectively, return *True*—this value will be the exact
>>> number of records in the *Recordset*, regardless of whether it has been
>>> fully populated. If the *Recordset* object does not support approximate
>>> positioning, this property may be a significant drain on resources
>>> because all records will have to be retrieved and counted to return an
>>> accurate *RecordCount* value.
>>>
>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider fetches
>>> all records when a server-side cursor is used despite the fact that it
>>> returns *True* for both *Supports (adApproxPosition)* and *Supports
>>> (adBookmark)*,
>>>
>>> The cursor type of the *Recordset* object affects whether the number of
>>> records can be determined. The *RecordCount* property will return -1 for
>>> a forward-only cursor; the actual count for a static or keyset cursor;
>>> and either -1 or the actual count for a dynamic cursor, depending on the
>>> data source.
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> http://www.xailer.com
>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> > Hola,
>>> >
>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>> >
>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>> > :oDataSource := ::oAdoCdt
>>> > :cProcess := "GENERAL"
>>> > :nCursorLocation := adUseServer
>>> > :nCursorType := adOpenForwardOnly
>>> > :cSelect := "SELECT * FROM TABLA"
>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>> > :Create()
>>> > END
>>> >
>>> > ¿Estas dos lineas que se supone que retornan?
>>> > ::oSQL:Recno()
>>> > ::oSQL:RecCount()
>>> >
>>> >
>>> > Gracias.
>>> >
>>> > Saludos. Miguel A. Torrellas
>
>
jose.luis
Mensajes: 1633
Registrado: Vie Oct 14, 2005 10:56 pm

TSQLQuery

Mensaje por jose.luis »

Miguel,
Y si primero haces un select count(*) de los registros que te vas a traer y
luego, en el bucle mantienes tu el contador ??
Saludos,
José Luis Capel
"Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
> Gracias Jose Luis.
>
> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566 filas,
> claro, en cursor cliente, el hecho de abrirla con acceso remoto, pues eso,
> sin comentarios. Con la configuración del cursor como la he puesto, los
> accesos son mas que aceptables, solo me faltaria saber como introducir el
> dato en el SELECT para poder enviarlo al TProgressbar.
>
> Saludos. Miguel A. Torrellas
>
> José Luis Capel - Aicom escribió:
>> Miguel,
>>
>> So pena de penalizar el rendimiento, prueba a utilizar un cursor cliente.
>>
>> Saludos,
>> José Luis Capel
>>
>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>> Gracias Ignacio, lo sospechaba
>>>
>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>> Server para incorporar el dato al SELECT, de momento no las encuentro,
>>> si me puedes ayudar quedaré agradecido.
>>>
>>> Saludos de nuevo.
>>>
>>> Ignacio Ortiz de Zúñiga escribió:
>>>> Miguel,
>>>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>>>> recuperación de Bookmark ni tampoco RecordCount.
>>>> Un saludo
>>>> Bookmark Property
>>>>
>>>> Indicates a bookmark that uniquely identifies the current record in a
>>>> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>> object or sets the current record in a *Recordset* object to the record
>>>> identified by a valid bookmark.
>>>>
>>>>
>>>> Settings and Return Values
>>>>
>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>> bookmark.
>>>>
>>>>
>>>> Remarks
>>>>
>>>> Use the *Bookmark* property to save the position of the current record
>>>> and return to that record at any time. Bookmarks are available only in
>>>> *Recordset* objects that support bookmark functionality.
>>>>
>>>> When you open a *Recordset* object, each of its records has a unique
>>>> bookmark. To save the bookmark for the current record, assign the value
>>>> of the *Bookmark* property to a variable. To quickly return to that
>>>> record at any time after moving to a different record, set the
>>>> *Recordset* object's *Bookmark* property to the value of that variable.
>>>>
>>>> The user may not be able to view the value of the bookmark. Also, users
>>>> should not expect bookmarks to be directly comparable—two bookmarks
>>>> that refer to the same record may have different values.
>>>>
>>>> If you use the Clone
>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
>>>> create a copy of a *Recordset* object, the *Bookmark* property settings
>>>> for the original and the duplicate *Recordset* objects are identical
>>>> and you can use them interchangeably. However, you cannot use bookmarks
>>>> from different *Recordset* objects interchangeably, even if they were
>>>> created from the same source or command.
>>>>
>>>> *Remote Data Service Usage *When used on a client-side
>>>> *Recordset*
>>>> object, the *Bookmark* property is always available.
>>>>
>>>>
>>>> RecordCount Property
>>>>
>>>> Indicates the number of records in a Recordset
>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>>>
>>>>
>>>> Return Value
>>>>
>>>> Returns a *Long* value that indicates the number of records in the
>>>> *Recordset*.
>>>>
>>>>
>>>> Remarks
>>>>
>>>> Use the *RecordCount* property to find out how many records are in a
>>>> *Recordset* object. The property returns -1 when ADO cannot determine
>>>> the number of records or if the provider or cursor
>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>> type does not support *RecordCount*. Reading the *RecordCount* property
>>>> on a closed *Recordset* causes an error.
>>>>
>>>> If the *Recordset* object supports approximate positioning or
>>>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>>>> (adBookmark)*, respectively, return *True*—this value will be the exact
>>>> number of records in the *Recordset*, regardless of whether it has been
>>>> fully populated. If the *Recordset* object does not support approximate
>>>> positioning, this property may be a significant drain on resources
>>>> because all records will have to be retrieved and counted to return an
>>>> accurate *RecordCount* value.
>>>>
>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>> fetches all records when a server-side cursor is used despite the fact
>>>> that it returns *True* for both *Supports (adApproxPosition)* and
>>>> *Supports (adBookmark)*,
>>>>
>>>> The cursor type of the *Recordset* object affects whether the number of
>>>> records can be determined. The *RecordCount* property will return -1
>>>> for a forward-only cursor; the actual count for a static or keyset
>>>> cursor; and either -1 or the actual count for a dynamic cursor,
>>>> depending on the data source.
>>>>
>>>>
>>>> --
>>>> Ignacio Ortiz de Zúñiga
>>>> http://www.xailer.com
>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>> > Hola,
>>>> >
>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>> >
>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>> > :oDataSource := ::oAdoCdt
>>>> > :cProcess := "GENERAL"
>>>> > :nCursorLocation := adUseServer
>>>> > :nCursorType := adOpenForwardOnly
>>>> > :cSelect := "SELECT * FROM TABLA"
>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>> > :Create()
>>>> > END
>>>> >
>>>> > ¿Estas dos lineas que se supone que retornan?
>>>> > ::oSQL:Recno()
>>>> > ::oSQL:RecCount()
>>>> >
>>>> >
>>>> > Gracias.
>>>> >
>>>> > Saludos. Miguel A. Torrellas
>>
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9250
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TSQLQuery

Mensaje por ignacio »

Miguel,
Para la ProgressBar sólo necesitarías saber el total de registros y lo
puedes conseguir muy rápidamente con:
oDataSource:QueryValue( "SELECT COUNT(*) ..." )
Saludos
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
> Gracias Ignacio, lo sospechaba
>
> La idea era utilizar TProgressbar, estoy buscando funciones de SQL Server
> para incorporar el dato al SELECT, de momento no las encuentro, si me
> puedes ayudar quedaré agradecido.
>
> Saludos de nuevo.
>
> Ignacio Ortiz de Zúñiga escribió:
>> Miguel,
>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>> recuperación de Bookmark ni tampoco RecordCount.
>> Un saludo
>> Bookmark Property
>>
>> Indicates a bookmark that uniquely identifies the current record in a
>> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>> object or sets the current record in a *Recordset* object to the record
>> identified by a valid bookmark.
>>
>>
>> Settings and Return Values
>>
>> Sets or returns a *Variant* expression that evaluates to a valid
>> bookmark.
>>
>>
>> Remarks
>>
>> Use the *Bookmark* property to save the position of the current record
>> and return to that record at any time. Bookmarks are available only in
>> *Recordset* objects that support bookmark functionality.
>>
>> When you open a *Recordset* object, each of its records has a unique
>> bookmark. To save the bookmark for the current record, assign the value
>> of the *Bookmark* property to a variable. To quickly return to that
>> record at any time after moving to a different record, set the
>> *Recordset* object's *Bookmark* property to the value of that variable.
>>
>> The user may not be able to view the value of the bookmark. Also, users
>> should not expect bookmarks to be directly comparable—two bookmarks that
>> refer to the same record may have different values.
>>
>> If you use the Clone
>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
>> create a copy of a *Recordset* object, the *Bookmark* property settings
>> for the original and the duplicate *Recordset* objects are identical and
>> you can use them interchangeably. However, you cannot use bookmarks from
>> different *Recordset* objects interchangeably, even if they were created
>> from the same source or command.
>>
>> *Remote Data Service Usage *When used on a client-side *Recordset*
>> object, the *Bookmark* property is always available.
>>
>>
>> RecordCount Property
>>
>> Indicates the number of records in a Recordset
>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>
>>
>> Return Value
>>
>> Returns a *Long* value that indicates the number of records in the
>> *Recordset*.
>>
>>
>> Remarks
>>
>> Use the *RecordCount* property to find out how many records are in a
>> *Recordset* object. The property returns -1 when ADO cannot determine the
>> number of records or if the provider or cursor
>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>> type does not support *RecordCount*. Reading the *RecordCount* property
>> on a closed *Recordset* causes an error.
>>
>> If the *Recordset* object supports approximate positioning or
>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>> (adBookmark)*, respectively, return *True*—this value will be the exact
>> number of records in the *Recordset*, regardless of whether it has been
>> fully populated. If the *Recordset* object does not support approximate
>> positioning, this property may be a significant drain on resources
>> because all records will have to be retrieved and counted to return an
>> accurate *RecordCount* value.
>>
>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider fetches
>> all records when a server-side cursor is used despite the fact that it
>> returns *True* for both *Supports (adApproxPosition)* and *Supports
>> (adBookmark)*,
>>
>> The cursor type of the *Recordset* object affects whether the number of
>> records can be determined. The *RecordCount* property will return -1 for
>> a forward-only cursor; the actual count for a static or keyset cursor;
>> and either -1 or the actual count for a dynamic cursor, depending on the
>> data source.
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> http://www.xailer.com
>> "Miguel A. Torrellas" <miguel@torrellas.net
>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> > Hola,
>> >
>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>> >
>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>> > :oDataSource := ::oAdoCdt
>> > :cProcess := "GENERAL"
>> > :nCursorLocation := adUseServer
>> > :nCursorType := adOpenForwardOnly
>> > :cSelect := "SELECT * FROM TABLA"
>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>> > :Create()
>> > END
>> >
>> > ¿Estas dos lineas que se supone que retornan?
>> > ::oSQL:Recno()
>> > ::oSQL:RecCount()
>> >
>> >
>> > Gracias.
>> >
>> > Saludos. Miguel A. Torrellas
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
miguel
Mensajes: 364
Registrado: Jue Jul 02, 2009 1:09 pm

TSQLQuery

Mensaje por miguel »

Gracias por vuestras respuestas Ignacio y Jose Luis..
Como no encuentro la forma de obtener el nº de fila, asi es como lo he
dejado.
Saludos.
José Luis Capel - Aicom escribió:
> Miguel,
>
> Y si primero haces un select count(*) de los registros que te vas a traer y
> luego, en el bucle mantienes tu el contador ??
>
> Saludos,
> José Luis Capel
>
> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>> Gracias Jose Luis.
>>
>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566 filas,
>> claro, en cursor cliente, el hecho de abrirla con acceso remoto, pues eso,
>> sin comentarios. Con la configuración del cursor como la he puesto, los
>> accesos son mas que aceptables, solo me faltaria saber como introducir el
>> dato en el SELECT para poder enviarlo al TProgressbar.
>>
>> Saludos. Miguel A. Torrellas
>>
>> José Luis Capel - Aicom escribió:
>>> Miguel,
>>>
>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor cliente.
>>>
>>> Saludos,
>>> José Luis Capel
>>>
>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>> Gracias Ignacio, lo sospechaba
>>>>
>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>> Server para incorporar el dato al SELECT, de momento no las encuentro,
>>>> si me puedes ayudar quedaré agradecido.
>>>>
>>>> Saludos de nuevo.
>>>>
>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>> Miguel,
>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>>>>> recuperación de Bookmark ni tampoco RecordCount.
>>>>> Un saludo
>>>>> Bookmark Property
>>>>>
>>>>> Indicates a bookmark that uniquely identifies the current record in a
>>>>> Recordset <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>> object or sets the current record in a *Recordset* object to the record
>>>>> identified by a valid bookmark.
>>>>>
>>>>>
>>>>> Settings and Return Values
>>>>>
>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>> bookmark.
>>>>>
>>>>>
>>>>> Remarks
>>>>>
>>>>> Use the *Bookmark* property to save the position of the current record
>>>>> and return to that record at any time. Bookmarks are available only in
>>>>> *Recordset* objects that support bookmark functionality.
>>>>>
>>>>> When you open a *Recordset* object, each of its records has a unique
>>>>> bookmark. To save the bookmark for the current record, assign the value
>>>>> of the *Bookmark* property to a variable. To quickly return to that
>>>>> record at any time after moving to a different record, set the
>>>>> *Recordset* object's *Bookmark* property to the value of that variable.
>>>>>
>>>>> The user may not be able to view the value of the bookmark. Also, users
>>>>> should not expect bookmarks to be directly comparable—two bookmarks
>>>>> that refer to the same record may have different values.
>>>>>
>>>>> If you use the Clone
>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method to
>>>>> create a copy of a *Recordset* object, the *Bookmark* property settings
>>>>> for the original and the duplicate *Recordset* objects are identical
>>>>> and you can use them interchangeably. However, you cannot use bookmarks
>>>>> from different *Recordset* objects interchangeably, even if they were
>>>>> created from the same source or command.
>>>>>
>>>>> *Remote Data Service Usage *When used on a client-side
>>>>> *Recordset*
>>>>> object, the *Bookmark* property is always available.
>>>>>
>>>>>
>>>>> RecordCount Property
>>>>>
>>>>> Indicates the number of records in a Recordset
>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>>>>
>>>>>
>>>>> Return Value
>>>>>
>>>>> Returns a *Long* value that indicates the number of records in the
>>>>> *Recordset*.
>>>>>
>>>>>
>>>>> Remarks
>>>>>
>>>>> Use the *RecordCount* property to find out how many records are in a
>>>>> *Recordset* object. The property returns -1 when ADO cannot determine
>>>>> the number of records or if the provider or cursor
>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>> type does not support *RecordCount*. Reading the *RecordCount* property
>>>>> on a closed *Recordset* causes an error.
>>>>>
>>>>> If the *Recordset* object supports approximate positioning or
>>>>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>>>>> (adBookmark)*, respectively, return *True*—this value will be the exact
>>>>> number of records in the *Recordset*, regardless of whether it has been
>>>>> fully populated. If the *Recordset* object does not support approximate
>>>>> positioning, this property may be a significant drain on resources
>>>>> because all records will have to be retrieved and counted to return an
>>>>> accurate *RecordCount* value.
>>>>>
>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>> fetches all records when a server-side cursor is used despite the fact
>>>>> that it returns *True* for both *Supports (adApproxPosition)* and
>>>>> *Supports (adBookmark)*,
>>>>>
>>>>> The cursor type of the *Recordset* object affects whether the number of
>>>>> records can be determined. The *RecordCount* property will return -1
>>>>> for a forward-only cursor; the actual count for a static or keyset
>>>>> cursor; and either -1 or the actual count for a dynamic cursor,
>>>>> depending on the data source.
>>>>>
>>>>>
>>>>> --
>>>>> Ignacio Ortiz de Zúñiga
>>>>> http://www.xailer.com
>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>> > Hola,
>>>>> >
>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>> >
>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>> > :oDataSource := ::oAdoCdt
>>>>> > :cProcess := "GENERAL"
>>>>> > :nCursorLocation := adUseServer
>>>>> > :nCursorType := adOpenForwardOnly
>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>> > :Create()
>>>>> > END
>>>>> >
>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>> > ::oSQL:Recno()
>>>>> > ::oSQL:RecCount()
>>>>> >
>>>>> >
>>>>> > Gracias.
>>>>> >
>>>>> > Saludos. Miguel A. Torrellas
>
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9250
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TSQLQuery

Mensaje por ignacio »

Miguel,
oProgressBar:nValue ++ en cada iteración.
Saludos
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
news:46011416$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Gracias por vuestras respuestas Ignacio y Jose Luis..
>
> Como no encuentro la forma de obtener el nº de fila, asi es como lo he
> dejado.
>
> Saludos.
>
> José Luis Capel - Aicom escribió:
>> Miguel,
>>
>> Y si primero haces un select count(*) de los registros que te vas a traer
>> y luego, en el bucle mantienes tu el contador ??
>>
>> Saludos,
>> José Luis Capel
>>
>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>>> Gracias Jose Luis.
>>>
>>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
>>> filas, claro, en cursor cliente, el hecho de abrirla con acceso remoto,
>>> pues eso, sin comentarios. Con la configuración del cursor como la he
>>> puesto, los accesos son mas que aceptables, solo me faltaria saber como
>>> introducir el dato en el SELECT para poder enviarlo al TProgressbar.
>>>
>>> Saludos. Miguel A. Torrellas
>>>
>>> José Luis Capel - Aicom escribió:
>>>> Miguel,
>>>>
>>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor
>>>> cliente.
>>>>
>>>> Saludos,
>>>> José Luis Capel
>>>>
>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>>> Gracias Ignacio, lo sospechaba
>>>>>
>>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>>> Server para incorporar el dato al SELECT, de momento no las encuentro,
>>>>> si me puedes ayudar quedaré agradecido.
>>>>>
>>>>> Saludos de nuevo.
>>>>>
>>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>>> Miguel,
>>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta ni
>>>>>> recuperación de Bookmark ni tampoco RecordCount.
>>>>>> Un saludo
>>>>>> Bookmark Property
>>>>>>
>>>>>> Indicates a bookmark that uniquely identifies the current record in a
>>>>>> Recordset
>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object
>>>>>> or sets the current record in a *Recordset* object to the record
>>>>>> identified by a valid bookmark.
>>>>>>
>>>>>>
>>>>>> Settings and Return Values
>>>>>>
>>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>>> bookmark.
>>>>>>
>>>>>>
>>>>>> Remarks
>>>>>>
>>>>>> Use the *Bookmark* property to save the position of the current
>>>>>> record and return to that record at any time. Bookmarks are available
>>>>>> only in *Recordset* objects that support bookmark functionality.
>>>>>>
>>>>>> When you open a *Recordset* object, each of its records has a unique
>>>>>> bookmark. To save the bookmark for the current record, assign the
>>>>>> value of the *Bookmark* property to a variable. To quickly return to
>>>>>> that record at any time after moving to a different record, set the
>>>>>> *Recordset* object's *Bookmark* property to the value of that
>>>>>> variable.
>>>>>>
>>>>>> The user may not be able to view the value of the bookmark. Also,
>>>>>> users should not expect bookmarks to be directly comparable—two
>>>>>> bookmarks that refer to the same record may have different values.
>>>>>>
>>>>>> If you use the Clone
>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method
>>>>>> to create a copy of a *Recordset* object, the *Bookmark* property
>>>>>> settings for the original and the duplicate *Recordset* objects are
>>>>>> identical and you can use them interchangeably. However, you cannot
>>>>>> use bookmarks from different *Recordset* objects interchangeably,
>>>>>> even if they were created from the same source or command.
>>>>>>
>>>>>> *Remote Data Service Usage *When used on a client-side
>>>>>> *Recordset*
>>>>>> object, the *Bookmark* property is always available.
>>>>>>
>>>>>>
>>>>>> RecordCount Property
>>>>>>
>>>>>> Indicates the number of records in a Recordset
>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object.
>>>>>>
>>>>>>
>>>>>> Return Value
>>>>>>
>>>>>> Returns a *Long* value that indicates the number of records in the
>>>>>> *Recordset*.
>>>>>>
>>>>>>
>>>>>> Remarks
>>>>>>
>>>>>> Use the *RecordCount* property to find out how many records are in a
>>>>>> *Recordset* object. The property returns -1 when ADO cannot determine
>>>>>> the number of records or if the provider or cursor
>>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>>> type does not support *RecordCount*. Reading the *RecordCount*
>>>>>> property on a closed *Recordset* causes an error.
>>>>>>
>>>>>> If the *Recordset* object supports approximate positioning or
>>>>>> bookmarks—that is, *Supports (adApproxPosition)* or *Supports
>>>>>> (adBookmark)*, respectively, return *True*—this value will be the
>>>>>> exact number of records in the *Recordset*, regardless of whether it
>>>>>> has been fully populated. If the *Recordset* object does not support
>>>>>> approximate positioning, this property may be a significant drain on
>>>>>> resources because all records will have to be retrieved and counted
>>>>>> to return an accurate *RecordCount* value.
>>>>>>
>>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>>> fetches all records when a server-side cursor is used despite the
>>>>>> fact that it returns *True* for both *Supports (adApproxPosition)*
>>>>>> and *Supports (adBookmark)*,
>>>>>>
>>>>>> The cursor type of the *Recordset* object affects whether the number
>>>>>> of records can be determined. The *RecordCount* property will
>>>>>> return -1 for a forward-only cursor; the actual count for a static or
>>>>>> keyset cursor; and either -1 or the actual count for a dynamic
>>>>>> cursor, depending on the data source.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Ignacio Ortiz de Zúñiga
>>>>>> http://www.xailer.com
>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>>> > Hola,
>>>>>> >
>>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>>> >
>>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>>> > :oDataSource := ::oAdoCdt
>>>>>> > :cProcess := "GENERAL"
>>>>>> > :nCursorLocation := adUseServer
>>>>>> > :nCursorType := adOpenForwardOnly
>>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>> > :Create()
>>>>>> > END
>>>>>> >
>>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>>> > ::oSQL:Recno()
>>>>>> > ::oSQL:RecCount()
>>>>>> >
>>>>>> >
>>>>>> > Gracias.
>>>>>> >
>>>>>> > Saludos. Miguel A. Torrellas
>>
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Rolando
Mensajes: 191
Registrado: Lun May 08, 2006 2:10 pm

TSQLQuery

Mensaje por Rolando »

Hola:
José Luís e Ignacio, de que bucle y de que iteración hablan, si lo
que esta haciendo Miguel es "SELECT * FROM TABLA".
Saludos.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
news:460116f8$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Miguel,
>
> oProgressBar:nValue ++ en cada iteración.
>
> Saludos
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
> news:46011416$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Gracias por vuestras respuestas Ignacio y Jose Luis..
>>
>> Como no encuentro la forma de obtener el nº de fila, asi es como lo he
>> dejado.
>>
>> Saludos.
>>
>> José Luis Capel - Aicom escribió:
>>> Miguel,
>>>
>>> Y si primero haces un select count(*) de los registros que te vas a
>>> traer y luego, en el bucle mantienes tu el contador ??
>>>
>>> Saludos,
>>> José Luis Capel
>>>
>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>>>> Gracias Jose Luis.
>>>>
>>>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
>>>> filas, claro, en cursor cliente, el hecho de abrirla con acceso remoto,
>>>> pues eso, sin comentarios. Con la configuración del cursor como la he
>>>> puesto, los accesos son mas que aceptables, solo me faltaria saber como
>>>> introducir el dato en el SELECT para poder enviarlo al TProgressbar.
>>>>
>>>> Saludos. Miguel A. Torrellas
>>>>
>>>> José Luis Capel - Aicom escribió:
>>>>> Miguel,
>>>>>
>>>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor
>>>>> cliente.
>>>>>
>>>>> Saludos,
>>>>> José Luis Capel
>>>>>
>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>>>> Gracias Ignacio, lo sospechaba
>>>>>>
>>>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>>>> Server para incorporar el dato al SELECT, de momento no las
>>>>>> encuentro, si me puedes ayudar quedaré agradecido.
>>>>>>
>>>>>> Saludos de nuevo.
>>>>>>
>>>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>>>> Miguel,
>>>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta
>>>>>>> ni recuperación de Bookmark ni tampoco RecordCount.
>>>>>>> Un saludo
>>>>>>> Bookmark Property
>>>>>>>
>>>>>>> Indicates a bookmark that uniquely identifies the current record in
>>>>>>> a Recordset
>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm> object
>>>>>>> or sets the current record in a *Recordset* object to the record
>>>>>>> identified by a valid bookmark.
>>>>>>>
>>>>>>>
>>>>>>> Settings and Return Values
>>>>>>>
>>>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>>>> bookmark.
>>>>>>>
>>>>>>>
>>>>>>> Remarks
>>>>>>>
>>>>>>> Use the *Bookmark* property to save the position of the current
>>>>>>> record and return to that record at any time. Bookmarks are
>>>>>>> available only in *Recordset* objects that support bookmark
>>>>>>> functionality.
>>>>>>>
>>>>>>> When you open a *Recordset* object, each of its records has a unique
>>>>>>> bookmark. To save the bookmark for the current record, assign the
>>>>>>> value of the *Bookmark* property to a variable. To quickly return to
>>>>>>> that record at any time after moving to a different record, set the
>>>>>>> *Recordset* object's *Bookmark* property to the value of that
>>>>>>> variable.
>>>>>>>
>>>>>>> The user may not be able to view the value of the bookmark. Also,
>>>>>>> users should not expect bookmarks to be directly comparable-two
>>>>>>> bookmarks that refer to the same record may have different values.
>>>>>>>
>>>>>>> If you use the Clone
>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method
>>>>>>> to create a copy of a *Recordset* object, the *Bookmark* property
>>>>>>> settings for the original and the duplicate *Recordset* objects are
>>>>>>> identical and you can use them interchangeably. However, you cannot
>>>>>>> use bookmarks from different *Recordset* objects interchangeably,
>>>>>>> even if they were created from the same source or command.
>>>>>>>
>>>>>>> *Remote Data Service Usage *When used on a client-side
>>>>>>> *Recordset*
>>>>>>> object, the *Bookmark* property is always available.
>>>>>>>
>>>>>>>
>>>>>>> RecordCount Property
>>>>>>>
>>>>>>> Indicates the number of records in a Recordset
>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>> object.
>>>>>>>
>>>>>>>
>>>>>>> Return Value
>>>>>>>
>>>>>>> Returns a *Long* value that indicates the number of records in the
>>>>>>> *Recordset*.
>>>>>>>
>>>>>>>
>>>>>>> Remarks
>>>>>>>
>>>>>>> Use the *RecordCount* property to find out how many records are in a
>>>>>>> *Recordset* object. The property returns -1 when ADO cannot
>>>>>>> determine the number of records or if the provider or cursor
>>>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>>>> type does not support *RecordCount*. Reading the *RecordCount*
>>>>>>> property on a closed *Recordset* causes an error.
>>>>>>>
>>>>>>> If the *Recordset* object supports approximate positioning or
>>>>>>> bookmarks-that is, *Supports (adApproxPosition)* or *Supports
>>>>>>> (adBookmark)*, respectively, return *True*-this value will be the
>>>>>>> exact number of records in the *Recordset*, regardless of whether it
>>>>>>> has been fully populated. If the *Recordset* object does not support
>>>>>>> approximate positioning, this property may be a significant drain on
>>>>>>> resources because all records will have to be retrieved and counted
>>>>>>> to return an accurate *RecordCount* value.
>>>>>>>
>>>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>>>> fetches all records when a server-side cursor is used despite the
>>>>>>> fact that it returns *True* for both *Supports (adApproxPosition)*
>>>>>>> and *Supports (adBookmark)*,
>>>>>>>
>>>>>>> The cursor type of the *Recordset* object affects whether the number
>>>>>>> of records can be determined. The *RecordCount* property will
>>>>>>> return -1 for a forward-only cursor; the actual count for a static
>>>>>>> or keyset cursor; and either -1 or the actual count for a dynamic
>>>>>>> cursor, depending on the data source.
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Ignacio Ortiz de Zúñiga
>>>>>>> http://www.xailer.com
>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>>>> > Hola,
>>>>>>> >
>>>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>>>> >
>>>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>>>> > :oDataSource := ::oAdoCdt
>>>>>>> > :cProcess := "GENERAL"
>>>>>>> > :nCursorLocation := adUseServer
>>>>>>> > :nCursorType := adOpenForwardOnly
>>>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>> > :Create()
>>>>>>> > END
>>>>>>> >
>>>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>>>> > ::oSQL:Recno()
>>>>>>> > ::oSQL:RecCount()
>>>>>>> >
>>>>>>> >
>>>>>>> > Gracias.
>>>>>>> >
>>>>>>> > Saludos. Miguel A. Torrellas
>>>
>
>
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9250
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TSQLQuery

Mensaje por ignacio »

Rolando,
oDataset := oDataSource:Query( "SELECT * FROM TABLA" )
oDataset:lOpen := .t.
DO WHILE !oDataset:Eof()
............................
............................
oDataSet:MoveNext()
oProgressBar:nValue ++
ENDDO
Saludos
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Rolando Sarrailh" <rsarrailh@gmail.com> escribió en el mensaje
news:[email=460123a8@news.xailer.com...]460123a8@news.xailer.com...[/email]
> Hola:
> José Luís e Ignacio, de que bucle y de que iteración hablan, si lo
> que esta haciendo Miguel es "SELECT * FROM TABLA".
>
> Saludos.
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
> news:460116f8$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Miguel,
>>
>> oProgressBar:nValue ++ en cada iteración.
>>
>> Saludos
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> http://www.xailer.com
>>
>>
>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>> news:46011416$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Gracias por vuestras respuestas Ignacio y Jose Luis..
>>>
>>> Como no encuentro la forma de obtener el nº de fila, asi es como lo he
>>> dejado.
>>>
>>> Saludos.
>>>
>>> José Luis Capel - Aicom escribió:
>>>> Miguel,
>>>>
>>>> Y si primero haces un select count(*) de los registros que te vas a
>>>> traer y luego, en el bucle mantienes tu el contador ??
>>>>
>>>> Saludos,
>>>> José Luis Capel
>>>>
>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>>>>> Gracias Jose Luis.
>>>>>
>>>>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
>>>>> filas, claro, en cursor cliente, el hecho de abrirla con acceso
>>>>> remoto, pues eso, sin comentarios. Con la configuración del cursor
>>>>> como la he puesto, los accesos son mas que aceptables, solo me
>>>>> faltaria saber como introducir el dato en el SELECT para poder
>>>>> enviarlo al TProgressbar.
>>>>>
>>>>> Saludos. Miguel A. Torrellas
>>>>>
>>>>> José Luis Capel - Aicom escribió:
>>>>>> Miguel,
>>>>>>
>>>>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor
>>>>>> cliente.
>>>>>>
>>>>>> Saludos,
>>>>>> José Luis Capel
>>>>>>
>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>>>>> Gracias Ignacio, lo sospechaba
>>>>>>>
>>>>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>>>>> Server para incorporar el dato al SELECT, de momento no las
>>>>>>> encuentro, si me puedes ayudar quedaré agradecido.
>>>>>>>
>>>>>>> Saludos de nuevo.
>>>>>>>
>>>>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>>>>> Miguel,
>>>>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta
>>>>>>>> ni recuperación de Bookmark ni tampoco RecordCount.
>>>>>>>> Un saludo
>>>>>>>> Bookmark Property
>>>>>>>>
>>>>>>>> Indicates a bookmark that uniquely identifies the current record in
>>>>>>>> a Recordset
>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>> object or sets the current record in a *Recordset* object to the
>>>>>>>> record identified by a valid bookmark.
>>>>>>>>
>>>>>>>>
>>>>>>>> Settings and Return Values
>>>>>>>>
>>>>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>>>>> bookmark.
>>>>>>>>
>>>>>>>>
>>>>>>>> Remarks
>>>>>>>>
>>>>>>>> Use the *Bookmark* property to save the position of the current
>>>>>>>> record and return to that record at any time. Bookmarks are
>>>>>>>> available only in *Recordset* objects that support bookmark
>>>>>>>> functionality.
>>>>>>>>
>>>>>>>> When you open a *Recordset* object, each of its records has a
>>>>>>>> unique bookmark. To save the bookmark for the current record,
>>>>>>>> assign the value of the *Bookmark* property to a variable. To
>>>>>>>> quickly return to that record at any time after moving to a
>>>>>>>> different record, set the *Recordset* object's *Bookmark* property
>>>>>>>> to the value of that variable.
>>>>>>>>
>>>>>>>> The user may not be able to view the value of the bookmark. Also,
>>>>>>>> users should not expect bookmarks to be directly comparable-two
>>>>>>>> bookmarks that refer to the same record may have different values.
>>>>>>>>
>>>>>>>> If you use the Clone
>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm> method
>>>>>>>> to create a copy of a *Recordset* object, the *Bookmark* property
>>>>>>>> settings for the original and the duplicate *Recordset* objects are
>>>>>>>> identical and you can use them interchangeably. However, you cannot
>>>>>>>> use bookmarks from different *Recordset* objects interchangeably,
>>>>>>>> even if they were created from the same source or command.
>>>>>>>>
>>>>>>>> *Remote Data Service Usage *When used on a client-side
>>>>>>>> *Recordset*
>>>>>>>> object, the *Bookmark* property is always available.
>>>>>>>>
>>>>>>>>
>>>>>>>> RecordCount Property
>>>>>>>>
>>>>>>>> Indicates the number of records in a Recordset
>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>> object.
>>>>>>>>
>>>>>>>>
>>>>>>>> Return Value
>>>>>>>>
>>>>>>>> Returns a *Long* value that indicates the number of records in the
>>>>>>>> *Recordset*.
>>>>>>>>
>>>>>>>>
>>>>>>>> Remarks
>>>>>>>>
>>>>>>>> Use the *RecordCount* property to find out how many records are in
>>>>>>>> a *Recordset* object. The property returns -1 when ADO cannot
>>>>>>>> determine the number of records or if the provider or cursor
>>>>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>>>>> type does not support *RecordCount*. Reading the *RecordCount*
>>>>>>>> property on a closed *Recordset* causes an error.
>>>>>>>>
>>>>>>>> If the *Recordset* object supports approximate positioning or
>>>>>>>> bookmarks-that is, *Supports (adApproxPosition)* or *Supports
>>>>>>>> (adBookmark)*, respectively, return *True*-this value will be the
>>>>>>>> exact number of records in the *Recordset*, regardless of whether
>>>>>>>> it has been fully populated. If the *Recordset* object does not
>>>>>>>> support approximate positioning, this property may be a significant
>>>>>>>> drain on resources because all records will have to be retrieved
>>>>>>>> and counted to return an accurate *RecordCount* value.
>>>>>>>>
>>>>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>>>>> fetches all records when a server-side cursor is used despite the
>>>>>>>> fact that it returns *True* for both *Supports (adApproxPosition)*
>>>>>>>> and *Supports (adBookmark)*,
>>>>>>>>
>>>>>>>> The cursor type of the *Recordset* object affects whether the
>>>>>>>> number of records can be determined. The *RecordCount* property
>>>>>>>> will return -1 for a forward-only cursor; the actual count for a
>>>>>>>> static or keyset cursor; and either -1 or the actual count for a
>>>>>>>> dynamic cursor, depending on the data source.
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Ignacio Ortiz de Zúñiga
>>>>>>>> http://www.xailer.com
>>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>>>>> > Hola,
>>>>>>>> >
>>>>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>>>>> >
>>>>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>>>>> > :oDataSource := ::oAdoCdt
>>>>>>>> > :cProcess := "GENERAL"
>>>>>>>> > :nCursorLocation := adUseServer
>>>>>>>> > :nCursorType := adOpenForwardOnly
>>>>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>> > :Create()
>>>>>>>> > END
>>>>>>>> >
>>>>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>>>>> > ::oSQL:Recno()
>>>>>>>> > ::oSQL:RecCount()
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Gracias.
>>>>>>>> >
>>>>>>>> > Saludos. Miguel A. Torrellas
>>>>
>>
>>
>
>
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Rolando
Mensajes: 191
Registrado: Lun May 08, 2006 2:10 pm

TSQLQuery

Mensaje por Rolando »

Hola:
Yo creo que lo que quiere Miguel es que el ProgressBar funcione
mientras el servidor le está enviando los datos de su tablita de 100.000
registros, es decir de alguna manera incluirlo en el select.
Saludos.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
news:46012507$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Rolando,
>
> oDataset := oDataSource:Query( "SELECT * FROM TABLA" )
> oDataset:lOpen := .t.
> DO WHILE !oDataset:Eof()
> ............................
> ............................
> oDataSet:MoveNext()
> oProgressBar:nValue ++
> ENDDO
>
> Saludos
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Rolando Sarrailh" <rsarrailh@gmail.com> escribió en el mensaje
> news:[email=460123a8@news.xailer.com...]460123a8@news.xailer.com...[/email]
>> Hola:
>> José Luís e Ignacio, de que bucle y de que iteración hablan, si lo
>> que esta haciendo Miguel es "SELECT * FROM TABLA".
>>
>> Saludos.
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
>> news:460116f8$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Miguel,
>>>
>>> oProgressBar:nValue ++ en cada iteración.
>>>
>>> Saludos
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> http://www.xailer.com
>>>
>>>
>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>> news:46011416$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>> Gracias por vuestras respuestas Ignacio y Jose Luis..
>>>>
>>>> Como no encuentro la forma de obtener el nº de fila, asi es como lo he
>>>> dejado.
>>>>
>>>> Saludos.
>>>>
>>>> José Luis Capel - Aicom escribió:
>>>>> Miguel,
>>>>>
>>>>> Y si primero haces un select count(*) de los registros que te vas a
>>>>> traer y luego, en el bucle mantienes tu el contador ??
>>>>>
>>>>> Saludos,
>>>>> José Luis Capel
>>>>>
>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>>>>>> Gracias Jose Luis.
>>>>>>
>>>>>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
>>>>>> filas, claro, en cursor cliente, el hecho de abrirla con acceso
>>>>>> remoto, pues eso, sin comentarios. Con la configuración del cursor
>>>>>> como la he puesto, los accesos son mas que aceptables, solo me
>>>>>> faltaria saber como introducir el dato en el SELECT para poder
>>>>>> enviarlo al TProgressbar.
>>>>>>
>>>>>> Saludos. Miguel A. Torrellas
>>>>>>
>>>>>> José Luis Capel - Aicom escribió:
>>>>>>> Miguel,
>>>>>>>
>>>>>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor
>>>>>>> cliente.
>>>>>>>
>>>>>>> Saludos,
>>>>>>> José Luis Capel
>>>>>>>
>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>>>>>> Gracias Ignacio, lo sospechaba
>>>>>>>>
>>>>>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>>>>>> Server para incorporar el dato al SELECT, de momento no las
>>>>>>>> encuentro, si me puedes ayudar quedaré agradecido.
>>>>>>>>
>>>>>>>> Saludos de nuevo.
>>>>>>>>
>>>>>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>>>>>> Miguel,
>>>>>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta
>>>>>>>>> ni recuperación de Bookmark ni tampoco RecordCount.
>>>>>>>>> Un saludo
>>>>>>>>> Bookmark Property
>>>>>>>>>
>>>>>>>>> Indicates a bookmark that uniquely identifies the current record
>>>>>>>>> in a Recordset
>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>>> object or sets the current record in a *Recordset* object to the
>>>>>>>>> record identified by a valid bookmark.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Settings and Return Values
>>>>>>>>>
>>>>>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>>>>>> bookmark.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Remarks
>>>>>>>>>
>>>>>>>>> Use the *Bookmark* property to save the position of the current
>>>>>>>>> record and return to that record at any time. Bookmarks are
>>>>>>>>> available only in *Recordset* objects that support bookmark
>>>>>>>>> functionality.
>>>>>>>>>
>>>>>>>>> When you open a *Recordset* object, each of its records has a
>>>>>>>>> unique bookmark. To save the bookmark for the current record,
>>>>>>>>> assign the value of the *Bookmark* property to a variable. To
>>>>>>>>> quickly return to that record at any time after moving to a
>>>>>>>>> different record, set the *Recordset* object's *Bookmark* property
>>>>>>>>> to the value of that variable.
>>>>>>>>>
>>>>>>>>> The user may not be able to view the value of the bookmark. Also,
>>>>>>>>> users should not expect bookmarks to be directly comparable-two
>>>>>>>>> bookmarks that refer to the same record may have different values.
>>>>>>>>>
>>>>>>>>> If you use the Clone
>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm>
>>>>>>>>> method to create a copy of a *Recordset* object, the *Bookmark*
>>>>>>>>> property settings for the original and the duplicate *Recordset*
>>>>>>>>> objects are identical and you can use them interchangeably.
>>>>>>>>> However, you cannot use bookmarks from different *Recordset*
>>>>>>>>> objects interchangeably, even if they were created from the same
>>>>>>>>> source or command.
>>>>>>>>>
>>>>>>>>> *Remote Data Service Usage *When used on a client-side
>>>>>>>>> *Recordset*
>>>>>>>>> object, the *Bookmark* property is always available.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> RecordCount Property
>>>>>>>>>
>>>>>>>>> Indicates the number of records in a Recordset
>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>>> object.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Return Value
>>>>>>>>>
>>>>>>>>> Returns a *Long* value that indicates the number of records in the
>>>>>>>>> *Recordset*.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Remarks
>>>>>>>>>
>>>>>>>>> Use the *RecordCount* property to find out how many records are in
>>>>>>>>> a *Recordset* object. The property returns -1 when ADO cannot
>>>>>>>>> determine the number of records or if the provider or cursor
>>>>>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>>>>>> type does not support *RecordCount*. Reading the *RecordCount*
>>>>>>>>> property on a closed *Recordset* causes an error.
>>>>>>>>>
>>>>>>>>> If the *Recordset* object supports approximate positioning or
>>>>>>>>> bookmarks-that is, *Supports (adApproxPosition)* or *Supports
>>>>>>>>> (adBookmark)*, respectively, return *True*-this value will be the
>>>>>>>>> exact number of records in the *Recordset*, regardless of whether
>>>>>>>>> it has been fully populated. If the *Recordset* object does not
>>>>>>>>> support approximate positioning, this property may be a
>>>>>>>>> significant drain on resources because all records will have to be
>>>>>>>>> retrieved and counted to return an accurate *RecordCount* value.
>>>>>>>>>
>>>>>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>>>>>> fetches all records when a server-side cursor is used despite the
>>>>>>>>> fact that it returns *True* for both *Supports (adApproxPosition)*
>>>>>>>>> and *Supports (adBookmark)*,
>>>>>>>>>
>>>>>>>>> The cursor type of the *Recordset* object affects whether the
>>>>>>>>> number of records can be determined. The *RecordCount* property
>>>>>>>>> will return -1 for a forward-only cursor; the actual count for a
>>>>>>>>> static or keyset cursor; and either -1 or the actual count for a
>>>>>>>>> dynamic cursor, depending on the data source.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Ignacio Ortiz de Zúñiga
>>>>>>>>> http://www.xailer.com
>>>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>>>>>> > Hola,
>>>>>>>>> >
>>>>>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>>>>>> >
>>>>>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>>>>>> > :oDataSource := ::oAdoCdt
>>>>>>>>> > :cProcess := "GENERAL"
>>>>>>>>> > :nCursorLocation := adUseServer
>>>>>>>>> > :nCursorType := adOpenForwardOnly
>>>>>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>>> > :Create()
>>>>>>>>> > END
>>>>>>>>> >
>>>>>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>>>>>> > ::oSQL:Recno()
>>>>>>>>> > ::oSQL:RecCount()
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> > Gracias.
>>>>>>>>> >
>>>>>>>>> > Saludos. Miguel A. Torrellas
>>>>>
>>>
>>>
>>
>>
>
>
jose.luis
Mensajes: 1633
Registrado: Vie Oct 14, 2005 10:56 pm

TSQLQuery

Mensaje por jose.luis »

Rolando,
> Yo creo que lo que quiere Miguel es que el ProgressBar funcione
> mientras el servidor le está enviando los datos de su tablita de 100.000
> registros, es decir de alguna manera incluirlo en el select.
> Saludos.
Pues de momento no va a poder ser dado que a ADO se accede a través de la
case tOleAuto de xHarbour y, para desgracia nuestra, no admite eventos.
Si fuera posible recibir notificaciones de eventos de ADO perfectamente
podríamos lanzar consultas o comandos de modo asíncrono y mediante el evento
FetchProgress del objeto recordset ir actualizando el progressbar.
Saludos,
José Luis Capel
miguel
Mensajes: 364
Registrado: Jue Jul 02, 2009 1:09 pm

TSQLQuery

Mensaje por miguel »

Hola Rolando,
Quizas me explique mal o insuficientemente, yo querí­a decir lo que te
dice Ignacio.
Saludos. Miguel A. Torrellas
Rolando Sarrailh escribió:
> Hola:
> Yo creo que lo que quiere Miguel es que el ProgressBar funcione
> mientras el servidor le está enviando los datos de su tablita de 100.000
> registros, es decir de alguna manera incluirlo en el select.
> Saludos.
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
> news:46012507$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Rolando,
>>
>> oDataset := oDataSource:Query( "SELECT * FROM TABLA" )
>> oDataset:lOpen := .t.
>> DO WHILE !oDataset:Eof()
>> ............................
>> ............................
>> oDataSet:MoveNext()
>> oProgressBar:nValue ++
>> ENDDO
>>
>> Saludos
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> http://www.xailer.com
>>
>>
>> "Rolando Sarrailh" <rsarrailh@gmail.com> escribió en el mensaje
>> news:[email=460123a8@news.xailer.com...]460123a8@news.xailer.com...[/email]
>>> Hola:
>>> José Luí­s e Ignacio, de que bucle y de que iteración hablan, si lo
>>> que esta haciendo Miguel es "SELECT * FROM TABLA".
>>>
>>> Saludos.
>>>
>>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje
>>> news:460116f8$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>> Miguel,
>>>>
>>>> oProgressBar:nValue ++ en cada iteración.
>>>>
>>>> Saludos
>>>>
>>>> --
>>>> Ignacio Ortiz de Zúñiga
>>>> http://www.xailer.com
>>>>
>>>>
>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>> news:46011416$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>> Gracias por vuestras respuestas Ignacio y Jose Luis..
>>>>>
>>>>> Como no encuentro la forma de obtener el nº de fila, asi es como lo he
>>>>> dejado.
>>>>>
>>>>> Saludos.
>>>>>
>>>>> José Luis Capel - Aicom escribió:
>>>>>> Miguel,
>>>>>>
>>>>>> Y si primero haces un select count(*) de los registros que te vas a
>>>>>> traer y luego, en el bucle mantienes tu el contador ??
>>>>>>
>>>>>> Saludos,
>>>>>> José Luis Capel
>>>>>>
>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>>> news:[email=46010d29@news.xailer.com...]46010d29@news.xailer.com...[/email]
>>>>>>> Gracias Jose Luis.
>>>>>>>
>>>>>>> He hecho diversas pruebas, lo que pasa es que la tabla tiene 101566
>>>>>>> filas, claro, en cursor cliente, el hecho de abrirla con acceso
>>>>>>> remoto, pues eso, sin comentarios. Con la configuración del cursor
>>>>>>> como la he puesto, los accesos son mas que aceptables, solo me
>>>>>>> faltaria saber como introducir el dato en el SELECT para poder
>>>>>>> enviarlo al TProgressbar.
>>>>>>>
>>>>>>> Saludos. Miguel A. Torrellas
>>>>>>>
>>>>>>> José Luis Capel - Aicom escribió:
>>>>>>>> Miguel,
>>>>>>>>
>>>>>>>> So pena de penalizar el rendimiento, prueba a utilizar un cursor
>>>>>>>> cliente.
>>>>>>>>
>>>>>>>> Saludos,
>>>>>>>> José Luis Capel
>>>>>>>>
>>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net> escribió en el mensaje
>>>>>>>> news:[email=46010b11@news.xailer.com...]46010b11@news.xailer.com...[/email]
>>>>>>>>> Gracias Ignacio, lo sospechaba
>>>>>>>>>
>>>>>>>>> La idea era utilizar TProgressbar, estoy buscando funciones de SQL
>>>>>>>>> Server para incorporar el dato al SELECT, de momento no las
>>>>>>>>> encuentro, si me puedes ayudar quedaré agradecido.
>>>>>>>>>
>>>>>>>>> Saludos de nuevo.
>>>>>>>>>
>>>>>>>>> Ignacio Ortiz de Zúñiga escribió:
>>>>>>>>>> Miguel,
>>>>>>>>>> Seguramente generen un error ya que ese tipo de cursor no soporta
>>>>>>>>>> ni recuperación de Bookmark ni tampoco RecordCount.
>>>>>>>>>> Un saludo
>>>>>>>>>> Bookmark Property
>>>>>>>>>>
>>>>>>>>>> Indicates a bookmark that uniquely identifies the current record
>>>>>>>>>> in a Recordset
>>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>>>> object or sets the current record in a *Recordset* object to the
>>>>>>>>>> record identified by a valid bookmark.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Settings and Return Values
>>>>>>>>>>
>>>>>>>>>> Sets or returns a *Variant* expression that evaluates to a valid
>>>>>>>>>> bookmark.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Remarks
>>>>>>>>>>
>>>>>>>>>> Use the *Bookmark* property to save the position of the current
>>>>>>>>>> record and return to that record at any time. Bookmarks are
>>>>>>>>>> available only in *Recordset* objects that support bookmark
>>>>>>>>>> functionality.
>>>>>>>>>>
>>>>>>>>>> When you open a *Recordset* object, each of its records has a
>>>>>>>>>> unique bookmark. To save the bookmark for the current record,
>>>>>>>>>> assign the value of the *Bookmark* property to a variable. To
>>>>>>>>>> quickly return to that record at any time after moving to a
>>>>>>>>>> different record, set the *Recordset* object's *Bookmark* property
>>>>>>>>>> to the value of that variable.
>>>>>>>>>>
>>>>>>>>>> The user may not be able to view the value of the bookmark. Also,
>>>>>>>>>> users should not expect bookmarks to be directly comparable-two
>>>>>>>>>> bookmarks that refer to the same record may have different values.
>>>>>>>>>>
>>>>>>>>>> If you use the Clone
>>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdamth01_9.htm>
>>>>>>>>>> method to create a copy of a *Recordset* object, the *Bookmark*
>>>>>>>>>> property settings for the original and the duplicate *Recordset*
>>>>>>>>>> objects are identical and you can use them interchangeably.
>>>>>>>>>> However, you cannot use bookmarks from different *Recordset*
>>>>>>>>>> objects interchangeably, even if they were created from the same
>>>>>>>>>> source or command.
>>>>>>>>>>
>>>>>>>>>> *Remote Data Service Usage *When used on a client-side
>>>>>>>>>> *Recordset*
>>>>>>>>>> object, the *Bookmark* property is always available.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> RecordCount Property
>>>>>>>>>>
>>>>>>>>>> Indicates the number of records in a Recordset
>>>>>>>>>> <ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdaobj01_19.htm>
>>>>>>>>>> object.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Return Value
>>>>>>>>>>
>>>>>>>>>> Returns a *Long* value that indicates the number of records in the
>>>>>>>>>> *Recordset*.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Remarks
>>>>>>>>>>
>>>>>>>>>> Use the *RecordCount* property to find out how many records are in
>>>>>>>>>> a *Recordset* object. The property returns -1 when ADO cannot
>>>>>>>>>> determine the number of records or if the provider or cursor
>>>>>>>>>> < ms-help://MS.PSDKSVR2003SP1.1033/ado270/htm/mdadef01.htm#mdd efcursor>
>>>>>>>>>> type does not support *RecordCount*. Reading the *RecordCount*
>>>>>>>>>> property on a closed *Recordset* causes an error.
>>>>>>>>>>
>>>>>>>>>> If the *Recordset* object supports approximate positioning or
>>>>>>>>>> bookmarks-that is, *Supports (adApproxPosition)* or *Supports
>>>>>>>>>> (adBookmark)*, respectively, return *True*-this value will be the
>>>>>>>>>> exact number of records in the *Recordset*, regardless of whether
>>>>>>>>>> it has been fully populated. If the *Recordset* object does not
>>>>>>>>>> support approximate positioning, this property may be a
>>>>>>>>>> significant drain on resources because all records will have to be
>>>>>>>>>> retrieved and counted to return an accurate *RecordCount* value.
>>>>>>>>>>
>>>>>>>>>> *NOTE: *In ADO versions 2.8 and earlier, the SQLOLEDB provider
>>>>>>>>>> fetches all records when a server-side cursor is used despite the
>>>>>>>>>> fact that it returns *True* for both *Supports (adApproxPosition)*
>>>>>>>>>> and *Supports (adBookmark)*,
>>>>>>>>>>
>>>>>>>>>> The cursor type of the *Recordset* object affects whether the
>>>>>>>>>> number of records can be determined. The *RecordCount* property
>>>>>>>>>> will return -1 for a forward-only cursor; the actual count for a
>>>>>>>>>> static or keyset cursor; and either -1 or the actual count for a
>>>>>>>>>> dynamic cursor, depending on the data source.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Ignacio Ortiz de Zúñiga
>>>>>>>>>> http://www.xailer.com
>>>>>>>>>> "Miguel A. Torrellas" <miguel@torrellas.net
>>>>>>>>>> <mailto:miguel@torrellas.net>> escribió en el mensaje
>>>>>>>>>> news:46010284$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>>>>>>>>> > Hola,
>>>>>>>>>> >
>>>>>>>>>> > Siendo ::oAdoCDT un DataSource que ataca a SQLServer
>>>>>>>>>> >
>>>>>>>>>> > WITH OBJECT ::oSQL := TSQLQuery():New( Self )
>>>>>>>>>> > :oDataSource := ::oAdoCdt
>>>>>>>>>> > :cProcess := "GENERAL"
>>>>>>>>>> > :nCursorLocation := adUseServer
>>>>>>>>>> > :nCursorType := adOpenForwardOnly
>>>>>>>>>> > :cSelect := "SELECT * FROM TABLA"
>>>>>>>>>> > :OnPostOpen := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>>>> > :OnPostClose := {|o| ::oBtnImportar:lEnabled := o:lOpen}
>>>>>>>>>> > :Create()
>>>>>>>>>> > END
>>>>>>>>>> >
>>>>>>>>>> > ¿Estas dos lineas que se supone que retornan?
>>>>>>>>>> > ::oSQL:Recno()
>>>>>>>>>> > ::oSQL:RecCount()
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> > Gracias.
>>>>>>>>>> >
>>>>>>>>>> > Saludos. Miguel A. Torrellas
>>>>
>>>
>>
>
>
Responder