Using ADO to Read a Text File Does not Return First Record


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Using ADO to Read a Text File Does not Return First Record

  1. #1
    Larry Rebich Guest

    Using ADO to Read a Text File Does not Return First Record

    Please don't guess at an answer...

    I am SUCCESSFULLY connecting to a text file using ADO 2.6, but the recordset
    returned does not contain the first record of the text file even though I
    have specified: COLNAMEHEADER=FALSE. The docs state that this is the
    default. Otherwise the data being returned is good. The code entries are:

    sPath = "mypath"
    sFile = "myfile"

    sCon = "Driver={Microsoft Text Driver (*.txt; *.csv)}; "
    sCon = sCon & "DEFAULTDIR=" & sPath & "; "
    sCon = sCon & "Extensions=csv;"
    sCon = sCon & "COLNAMEHEADER=FALSE;"
    sCon = sCon & "Persist Security Info=False"

    cnn.Open sCon
    rs.Open "Select * from " & sFile, cnn, adOpenStatic, adLockReadOnly,
    adCmdText

    Is there some, unknown to me, parameter that I'm missing? Is anyone
    successfully using ADO to read a text file?

    Thanks and Cheers,
    Larry Rebich

    More tips link to:
    http://www.buygold.net/tips.html

    Please:
    No personal e-mail questions :-)





  2. #2
    Larry Rebich Guest

    Re: Using ADO to Read a Text File Does not Return First Record

    Further to my question - I have confirmed that the first record is being
    treated as a COLNAMEHEADER even thought I have specified that there is no
    header. And the docs say the default is 'no' header.

    Cheers,
    Larry Rebich





  3. #3
    Sergey Guest

    Re: Using ADO to Read a Text File Does not Return First Record

    For more info on how to access text file using ODBC, pay attention to
    schema.ini that describes the text file
    http://msdn.microsoft.com/library/ps...k/odbc6xyr.htm

    Sergey.

    "Larry Rebich" <lrebich@earthlink.net> wrote in message
    news:3a26919f@news.devx.com...
    > Please don't guess at an answer...
    >
    > I am SUCCESSFULLY connecting to a text file using ADO 2.6, but the

    recordset
    > returned does not contain the first record of the text file even though I
    > have specified: COLNAMEHEADER=FALSE. The docs state that this is the
    > default. Otherwise the data being returned is good. The code entries are:
    >
    > sPath = "mypath"
    > sFile = "myfile"
    >
    > sCon = "Driver={Microsoft Text Driver (*.txt; *.csv)}; "
    > sCon = sCon & "DEFAULTDIR=" & sPath & "; "
    > sCon = sCon & "Extensions=csv;"
    > sCon = sCon & "COLNAMEHEADER=FALSE;"
    > sCon = sCon & "Persist Security Info=False"
    >
    > cnn.Open sCon
    > rs.Open "Select * from " & sFile, cnn, adOpenStatic, adLockReadOnly,
    > adCmdText
    >
    > Is there some, unknown to me, parameter that I'm missing? Is anyone
    > successfully using ADO to read a text file?
    >
    > Thanks and Cheers,
    > Larry Rebich
    >
    > More tips link to:
    > http://www.buygold.net/tips.html
    >
    > Please:
    > No personal e-mail questions :-)
    >
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center