powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Почему rst.RecordCount всегда остается -1 ???
5 сообщений из 5, страница 1 из 1
Почему rst.RecordCount всегда остается -1 ???
    #32344016
Фотография Nrisimha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Почему rst.RecordCount всегда остается -1 ???

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
.....
        cmd.CommandType = adCmdText
        cmd.CommandText =  "select * from tblUserInfo" 
        Set rst = cmd.Execute
        If rst.RecordCount >  0  Then
        Else
            Add_data
        End If

........


Хотя записи есть точно, проверяются командой

debug.print rst.Fields (2)
и все выводится


Связь с MSSQL2000
...
Рейтинг: 0 / 0
Почему rst.RecordCount всегда остается -1 ???
    #32344093
Processor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
DoEvents перед If не поможет?
...
Рейтинг: 0 / 0
Почему rst.RecordCount всегда остается -1 ???
    #32344114
Фотография ulis
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
а так перед открытием набора не пробовал?
rst.LockType = adLockPessimistic
rst.CursorLocation = adUseClient
...
Рейтинг: 0 / 0
Почему rst.RecordCount всегда остается -1 ???
    #32344451
Hibernate
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
а так?
Код: plaintext
1.
rst.movelast
debug.print rst.RecordCount
...
Рейтинг: 0 / 0
Почему rst.RecordCount всегда остается -1 ???
    #32344497
Фотография Senin Viktor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Есть такая штука - справка.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
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
5 сообщений из 5, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Почему rst.RecordCount всегда остается -1 ???
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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