borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Registry)Next Topic (Textbox question) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Best CSV Open Method?
Poster Message
Tank
Level: Scholar

Registered: 30-09-2004
Posts: 41

icon Best CSV Open Method?

Hi All

My application needs to read in csv files from time to time. the number of records/rows can be from 1 to about 3000.
I am currently using ADO Connection, using the open method as...
cn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & sFilePath & ";Extensions=csv,txt"

Problem is that sometimes the first line in the file is not being read, and sometimes it is!?!
Once the recset is created I move though each record and check that all fields are correct and then call a DTS package to import the data. There can be 12 different tables that data can be imported into, but only one at a time.

Am I doing somthing wrong, or using the wrong type of CSV file connection?
Any help would be very much appreciated.
Regards
Tank

04-08-2005 at 04:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Best CSV Open Method?

Hi


Don't know why you're missing the first row sometimes, unless there is some setting for a header row being turned on or off.

You could try using a dts package to import the text file into an SQL table. Then view it and dts that.


Steve  

04-08-2005 at 03:37 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Best CSV Open Method?
Previous Topic (Registry)Next Topic (Textbox question) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder