INF: How to Use OLE DB Sample Text Provider in ADOLast reviewed: August 26, 1997Article ID: Q164586 |
The information in this article applies to:
SUMMARYThis article describes how you can use ADO to access the sample text OLE DB provider.
MORE INFORMATIONThe OLE DB SDK installs a sample text OLE DB provider that allows you to access text files. This sample text provider is located in the Samples\Sampprov directory. To use this sample text provider in ADO, you need to change the source code of the sample text provider, and you also need to change the ADO threading model. To do this, perform the following steps:
WARNING: Modifying the registry incorrectly can cause serious, system-wide problems that may require you to reinstall Windows NT to correct them. Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved. Use this tool at your own risk.
REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0000022C-0000-0010-8000- 00AA006D2EA4}\InprocServer32] "ThreadingModel"="Both" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000231-0000-0010-8000- 00AA006D2EA4}\InprocServer32] "ThreadingModel"="Both" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000280-0000-0010-8000- 00AA006D2EA4}\InprocServer32] "ThreadingModel"="Both" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000281-0000-0010-8000- 00AA006D2EA4}\InprocServer32] "ThreadingModel"="Both" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000293-0000-0010-8000- 00AA006D2EA4}\InprocServer32] "ThreadingModel"="Both"After you finish the two steps listed above, you can use the following Visual Basic code to use the sample text provider to retrieve data from a text file in ADO:
Private Sub myTest() Dim con As New ADODB.Connection Dim rs As ADODB.Recordset ' data source specifies path that contains customer.csv con.Open "provider=sampprov;data source=c:\\sdks\\oledbsdk\\samples\\sampclnt\\" Set rs = con.Execute("customer.csv") For i = 0 To rs.Fields.Count - 1 Print rs.Fields(i).Name Next i While Not rs.EOF Debug.Print rs(0) rs.MoveNext Wend End Sub |
Additional query words: ASP
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |