powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Delphi [игнор отключен] [закрыт для гостей] / Почему Query показывает RecordCount = -1?
6 сообщений из 6, страница 1 из 1
Почему Query показывает RecordCount = -1?
    #32165029
Andronick
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Хочу выяснить сколько записей в запросе
Showmessage(IntToStr(Query.RecordCount));
возвращает: - 1 ;
а в гриде отражается куча (почему, как выйти из ситуации?)
Спасибо за совет!
...
Рейтинг: 0 / 0
Почему Query показывает RecordCount = -1?
    #32165057
pkarklin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
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.

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.

А чтоб найти решение, воспользуйся поиском. Топиков было море.
...
Рейтинг: 0 / 0
Почему Query показывает RecordCount = -1?
    #32165147
Andronick
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Работает если шагнуть, на последнюю запись:
Query1.Last;
Showmessage(IntToStr(Query1.Recordcount));
Query1.First;
...
Рейтинг: 0 / 0
Почему Query показывает RecordCount = -1?
    #32167990
Фотография SmaLL
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Лучше использовать дополнительный запрос типа SELECT COUNT(*)...
...
Рейтинг: 0 / 0
Почему Query показывает RecordCount = -1?
    #32168169
dragonx
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Skoree vsego, kogda ti vizivaesh QUERY1.RECORDCOUNT u tebya
QUERY1.ACTIVE = FASLE, posmotri, vse rabotaet kak nado
...
Рейтинг: 0 / 0
Почему Query показывает RecordCount = -1?
    #32168178
Фотография Cat2
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Попробуйте обновить MDAC. Вроде бы этот глюк был в версиях ниже 2.6
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / Delphi [игнор отключен] [закрыт для гостей] / Почему Query показывает RecordCount = -1?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]