--- title: "InternetTimeout Property Example (VC++) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/20/2017" ms.reviewer: "" ms.topic: conceptual dev_langs: - "C++" helpviewer_keywords: - "InternetTimeout property [ADO], VC++ example" ms.assetid: 88b6d05c-d4eb-4ab1-bbe2-95d146237f94 author: MightyPen ms.author: genemi --- # InternetTimeout Property Example (VC++) > [!IMPORTANT] > Beginning with Windows 8 and Windows Server 2012, RDS server components are no longer included in the Windows operating system (see Windows 8 and [Windows Server 2012 Compatibility Cookbook](https://www.microsoft.com/download/details.aspx?id=27416) for more detail). RDS client components will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Applications that use RDS should migrate to [WCF Data Service](https://go.microsoft.com/fwlink/?LinkId=199565). This example demonstrates the [InternetTimeout](../../../ado/reference/rds-api/internettimeout-property-rds.md) property, which exists on the [DataControl](../../../ado/reference/rds-api/datacontrol-object-rds.md) and [DataSpace](../../../ado/reference/rds-api/dataspace-object-rds.md) objects. In this case, the **InternetTimeout** property is demonstrated on the **DataControl** object and the timeout is set to 20 seconds. ```cpp // BeginInternetTimeoutCpp #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \ no_namespace rename("EOF", "EndOfFile") #import "C:\Program Files\Common Files\System\MSADC\msadco.dll" #include #include #include // Function declarations inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);}; void InternetTimeOutX(void); void PrintProviderError(_ConnectionPtr pConnection); void PrintComError(_com_error &e); ////////////////////////////////////////////////////////// // // // Main Function // // // ////////////////////////////////////////////////////////// void main() { if(FAILED(::CoInitialize(NULL))) return; InternetTimeOutX(); ::CoUninitialize(); } ////////////////////////////////////////////////////////// // // // InternetTimeOutX Function // // // ////////////////////////////////////////////////////////// void InternetTimeOutX(void) { HRESULT hr = S_OK; // Define ADO object pointers. // Initialize pointers on define. // These are in the ADODB:: namespace. _RecordsetPtr pRst = NULL; //Define RDS object pointers RDS::IBindMgrPtr dc ; try { TESTHR(dc.CreateInstance(__uuidof(RDS::DataControl))); dc->Server = "https://MyServer"; dc->Connect = "Data Source='AuthorDatabase'"; dc->SQL = "SELECT * FROM Authors"; // Wait at least 20 seconds. dc->InternetTimeout = 20000; dc->Refresh(); // Use another Recordset as a convenience pRst = dc->GetRecordset(); while(!(pRst->EndOfFile)) { printf("%s %s",(LPSTR) (_bstr_t) pRst->Fields-> GetItem("au_fname")->Value, (LPSTR) (_bstr_t) pRst->Fields-> GetItem("au_lname")->Value); pRst->MoveNext(); } pRst->Close(); } catch (_com_error &e) { PrintProviderError(pRst->GetActiveConnection()); PrintComError(e); } } ////////////////////////////////////////////////////////// // // // PrintProviderError Function // // // ////////////////////////////////////////////////////////// void PrintProviderError(_ConnectionPtr pConnection) { // Print Provider Errors from Connection object. // pErr is a record object in the Connection's Error collection. ErrorPtr pErr = NULL; if( (pConnection->Errors->Count) > 0) { long nCount = pConnection->Errors->Count; // Collection ranges from 0 to nCount -1. for(long i = 0; i < nCount; i++) { pErr = pConnection->Errors->GetItem(i); printf("\t Error number: %x\t%s", pErr->Number, pErr->Description); } } } ////////////////////////////////////////////////////////// // // // PrintComError Function // // // ////////////////////////////////////////////////////////// void PrintComError(_com_error &e) { _bstr_t bstrSource(e.Source()); _bstr_t bstrDescription(e.Description()); // Print Com errors. printf("Error\n"); printf("\tCode = %08lx\n", e.Error()); printf("\tCode meaning = %s\n", e.ErrorMessage()); printf("\tSource = %s\n", (LPCSTR) bstrSource); printf("\tDescription = %s\n", (LPCSTR) bstrDescription); } // EndInternetTimeoutCpp ``` ## See Also [InternetTimeout Property (RDS)](../../../ado/reference/rds-api/internettimeout-property-rds.md)