<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>OLEDB</title>
        <link>http://blogs.ugidotnet.org/fgiossi/category/OLEDB.aspx</link>
        <description>Object Linking and Embedding - Database</description>
        <language>it-IT</language>
        <copyright>Francesco Giossi</copyright>
        <generator>Subtext Version 2.6.0.0</generator>
        <item>
            <title>OLEDB and text files</title>
            <link>http://blogs.ugidotnet.org/fgiossi/archive/2007/10/07/oledb-and-text-files.aspx</link>
            <description>This is a very quick example about OLEDB and read a text (.txt) file using Visual Basic 6.
The text file must be formatted as a simple CSV file with a field separator. Something like this
Test.txt
a;1;Test
b;2;Test
c;3;Test
d;4;Test
Supposing "Test.Txt" is stored in the root of the C: harddrive, the code will look like
----------------------------------------
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=""text;HDR=No;FMT=Delimited'"""
Set rs = CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM Test.txt", cn, 0, 1, 1
While Not rs.EOF
    Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, rs.Fields(2).Value
    rs.MoveNext
Wend
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing

----------------------------------------
Take a look to the connection string
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=""text;HDR=No;FMT=Delimited'"""

the Data Source=c:\; is the key. If you plan to store your text file in a different folde, let's say "c:\documents and settings\Auser\Documents\myTestFiles\", you are required to change the connection string this way:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and settings\Auser\Documents\myTestFiles\;Extended Properties=""text;HDR=No;FMT=Delimited'"""
&lt;img src="http://blogs.ugidotnet.org/fgiossi/aggbug/88799.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Francesco Giossi</dc:creator>
            <guid>http://blogs.ugidotnet.org/fgiossi/archive/2007/10/07/oledb-and-text-files.aspx</guid>
            <pubDate>Sun, 07 Oct 2007 21:00:14 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/fgiossi/archive/2007/10/07/oledb-and-text-files.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/fgiossi/comments/commentRss/88799.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/fgiossi/services/trackbacks/88799.aspx</trackback:ping>
        </item>
    </channel>
</rss>