|
|
|
кол-во записей =-1?? (ADO,VC++ )
|
|||
|---|---|---|---|
|
#18+
не могу понять,почему у меня кол-во записей рекордсета == -1 Записи-то в рекордсете есть,я их в отладчике вижу. Может быть,я что то не так делаю?? if(FAILED(::CoInitialize(NULL))) return; // Define Connection object pointer. // Initialize pointers on define. // These are in the ADODB:: namespace _ConnectionPtr pConnection = NULL; _CommandPtr pCmd = NULL; _ParameterPtr pPrm = NULL; try { // Open a connection using OLE DB syntax. TESTHR(pConnection.CreateInstance(__uuidof(Connection))); pConnection->ConnectionString = "Provider=SQLOLEDB.1;Data Source=ststest;Initial Catalog=Pubs;Integrated Security=SSPI"; pConnection->Open("","","",adConnectUnspecified); // Create Command object for stored procedure call TESTHR(pCmd.CreateInstance(__uuidof(Command))); pCmd->ActiveConnection = pConnection; pCmd->CommandText = "byroyalty"; // Define command parameter pPrm = pCmd->CreateParameter("percentage", adInteger, adParamInput, sizeof(long), (long)100); pCmd->Parameters->Append(pPrm); // Execute stored procedure _RecordsetPtr pRs = pCmd->Execute(NULL, NULL, adCmdStoredProc); _bstr_t bstrAUID; int s = pRs->RecordCount; while (!pRs->EndOfFile)// проверяю s == -1 { bstrAUID = pRs->Fields->GetItem("au_id")->Value; printf("%s\n", (LPCSTR) bstrAUID); pRs->MoveNext(); } // Cleanup objects before exit pRs->Close(); pConnection->Close(); } catch(_com_error &e) { PrintComError(e); } // Wait here for user to see the output.. printf("\nPress any key to continue..."); getch(); ::CoUninitialize(); ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.03.2004, 18:29 |
|
||
|
кол-во записей =-1?? (ADO,VC++ )
|
|||
|---|---|---|---|
|
#18+
Если курсор серверный, то он всегда быдет возвращать -1, нужно указать курсор = adUseClient (клиентский)... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.03.2004, 18:54 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=32455629&tid=2035241]: |
0ms |
get settings: |
10ms |
get forum list: |
21ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
82ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
56ms |
get tp. blocked users: |
2ms |
| others: | 231ms |
| total: | 425ms |

| 0 / 0 |
