Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Почему rst.RecordCount всегда остается -1 ??? / 5 сообщений из 5, страница 1 из 1
04.12.2003, 18:01
    #32344016
Nrisimha
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему rst.RecordCount всегда остается -1 ???
Почему 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
04.12.2003, 19:07
    #32344093
Processor
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему rst.RecordCount всегда остается -1 ???
DoEvents перед If не поможет?
...
Рейтинг: 0 / 0
04.12.2003, 19:44
    #32344114
ulis
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему rst.RecordCount всегда остается -1 ???
а так перед открытием набора не пробовал?
rst.LockType = adLockPessimistic
rst.CursorLocation = adUseClient
...
Рейтинг: 0 / 0
05.12.2003, 10:45
    #32344451
Hibernate
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему rst.RecordCount всегда остается -1 ???
а так?
Код: plaintext
1.
rst.movelast
debug.print rst.RecordCount
...
Рейтинг: 0 / 0
05.12.2003, 11:05
    #32344497
Senin Viktor
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему rst.RecordCount всегда остается -1 ???
Есть такая штука - справка.
Код: 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
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Почему rst.RecordCount всегда остается -1 ??? / 5 сообщений из 5, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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