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
miguel
Posts: 364
Joined: Thu Jul 02, 2009 1:09 pm

TSQLQuery

Postby miguel » Wed Mar 21, 2007 11:01 am

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
User avatar
ignacio
Site Admin
Posts: 8574
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

TSQLQuery

Postby ignacio » Wed Mar 21, 2007 11:11 am

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$1@news.xailer.com...
> 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]
http://www.xailer.com
http://www.xailer.info
miguel
Posts: 364
Joined: Thu Jul 02, 2009 1:09 pm

TSQLQuery

Postby miguel » Wed Mar 21, 2007 11:37 am

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$1@news.xailer.com...
> > 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
Posts: 1633
Joined: Fri Oct 14, 2005 10:56 pm

TSQLQuery

Postby jose.luis » Wed Mar 21, 2007 11:43 am

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:46010b11@news.xailer.com...
> 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$1@news.xailer.com...
>> > 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
Posts: 364
Joined: Thu Jul 02, 2009 1:09 pm

TSQLQuery

Postby miguel » Wed Mar 21, 2007 11:46 am

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:46010b11@news.xailer.com...
>> 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$1@news.xailer.com...
>>> > 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
Posts: 1633
Joined: Fri Oct 14, 2005 10:56 pm

TSQLQuery

Postby jose.luis » Wed Mar 21, 2007 11:54 am

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:46010d29@news.xailer.com...
> 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:46010b11@news.xailer.com...
>>> 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$1@news.xailer.com...
>>>> > 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
>>
User avatar
ignacio
Site Admin
Posts: 8574
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

TSQLQuery

Postby ignacio » Wed Mar 21, 2007 11:55 am

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:46010b11@news.xailer.com...
> 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$1@news.xailer.com...
>> > 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]
http://www.xailer.com
http://www.xailer.info
miguel
Posts: 364
Joined: Thu Jul 02, 2009 1:09 pm

TSQLQuery

Postby miguel » Wed Mar 21, 2007 12:16 pm

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:46010d29@news.xailer.com...
>> 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:46010b11@news.xailer.com...
>>>> 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$1@news.xailer.com...
>>>>> > 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
>
User avatar
ignacio
Site Admin
Posts: 8574
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

TSQLQuery

Postby ignacio » Wed Mar 21, 2007 12:28 pm

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$1@news.xailer.com...
> 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:46010d29@news.xailer.com...
>>> 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:46010b11@news.xailer.com...
>>>>> 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$1@news.xailer.com...
>>>>>> > 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]
http://www.xailer.com
http://www.xailer.info
Rolando
Posts: 191
Joined: Mon May 08, 2006 2:10 pm

TSQLQuery

Postby Rolando » Wed Mar 21, 2007 1:22 pm

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$1@news.xailer.com...
> 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$1@news.xailer.com...
>> 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:46010d29@news.xailer.com...
>>>> 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:46010b11@news.xailer.com...
>>>>>> 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$1@news.xailer.com...
>>>>>>> > 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
>>>
>
>
User avatar
ignacio
Site Admin
Posts: 8574
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

TSQLQuery

Postby ignacio » Wed Mar 21, 2007 1:28 pm

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:460123a8@news.xailer.com...
> 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$1@news.xailer.com...
>> 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$1@news.xailer.com...
>>> 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:46010d29@news.xailer.com...
>>>>> 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:46010b11@news.xailer.com...
>>>>>>> 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$1@news.xailer.com...
>>>>>>>> > 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]
http://www.xailer.com
http://www.xailer.info
Rolando
Posts: 191
Joined: Mon May 08, 2006 2:10 pm

TSQLQuery

Postby Rolando » Thu Mar 22, 2007 1:08 am

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$1@news.xailer.com...
> 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:460123a8@news.xailer.com...
>> 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$1@news.xailer.com...
>>> 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$1@news.xailer.com...
>>>> 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:46010d29@news.xailer.com...
>>>>>> 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:46010b11@news.xailer.com...
>>>>>>>> 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$1@news.xailer.com...
>>>>>>>>> > 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
Posts: 1633
Joined: Fri Oct 14, 2005 10:56 pm

TSQLQuery

Postby jose.luis » Thu Mar 22, 2007 9:16 am

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
Posts: 364
Joined: Thu Jul 02, 2009 1:09 pm

TSQLQuery

Postby miguel » Fri Mar 23, 2007 12:53 am

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$1@news.xailer.com...
>> 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:460123a8@news.xailer.com...
>>> 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$1@news.xailer.com...
>>>> 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$1@news.xailer.com...
>>>>> 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:46010d29@news.xailer.com...
>>>>>>> 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:46010b11@news.xailer.com...
>>>>>>>>> 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$1@news.xailer.com...
>>>>>>>>>> > 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
>>>>
>>>
>>
>
>

Return to “SQL”