Microsoft KB Archive/252162

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 08:44, 21 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")
Knowledge Base


PSS ID Number: 252162

Article Last Modified on 8/24/2001



The information in this article applies to:

  • ActiveX Data Objects (ADO) 2.5, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • ActiveX Data Objects (ADO) 2.6, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • ActiveX Data Objects (ADO) 2.7, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0



This article was previously published under Q252162

SUMMARY

ADO 2.5 introduces a new object called Stream. This object allows for streams of data to be opened based on binary data or text. The streams can be created from URLs or ADO 2.5 record objects. Adovcstream.exe is a self-extracting file that contains the source and project files for a Visual C++ 6.0 project. Create a new directory for the project, extract the files, then open the project in Visual C++ and build it to create an .exe file.

This sample illustrates a console application that uses the stream interface to retrieve an HTML file on the Internet.

Here is the key portion of the sample code that demonstrates the use of the ADO 2.5 Stream object:

   _StreamPtr   spStream;

   hr = spStream.CreateInstance(__uuidof(Stream));
        
   // Gonna read the MSFT stock split info page
   _variant_t varUrl = "URL=http://microsoft.com/msft/stock/splits.htm";
    
   // Tell the stream what type of data it is reading
   // Charset values can be found in registry,
   // HKEY_CLASSES_ROOT\MIME\Database\Charset 
   //Set it to Western
   spStream->Charset = "iso-8859-1";

   //Open stream as read only,default options,no username, no password
                
   hr = spStream->Open(varUrl,adModeRead,adOpenStreamUnspecified,"","");

   printf("Reading http://microsoft.com/msft/stock/splits.htm ...\n\n");

   //Read the whole page into a bstr 
   _bstr_t bstrSplitPage = spStream->ReadText(adReadAll);
        
   //Close the stream ASAP since we don't need it anymore
   spStream->Close();
                

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:

Release Date: September 1, 2000

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on secure servers that prevent any unauthorized changes to the file.


REFERENCES

Programming ADO by David Sceppa, Microsoft Press; ISBN: 0735607648


Additional query words: vc ADOVCStream mdac

Keywords: kbDatabase kbDSupport kbfile kbhowto kbSample KB252162
Technology: kbADO250 kbADO260 kbADO270 kbADOsearch kbAudDeveloper kbVC32bitSearch kbVC600 kbVCsearch