Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem accessing CSV with ADO if "=" prefix

Status
Not open for further replies.

Raydr

IS-IT--Management
Mar 19, 2002
20
US
I download, every week, a CSV file containing a very large amount of data. It consists of subscriber account information.

Here is a sample of how the data comes out:

="433030040404089273119",1400,"KIMBLE,SEAN","BRYAN",TX,77801,IE,="",2215

I access it using ADO, here's the connection string:

db.Open ("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\;Extensions=asc,csv,tab,txt;Persist Security Info=False;")

strSQL = "SELECT * FROM qc.csv"

Call OpenConnectionMS

rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseClient
rs.Open strSQL, db

Set DataGrid1.DataSource = rs

Ignore the naming/programming conventions, as this is a sample.

The problem is that the CSV file comes with equal signs in front of some fields, mostly because most people opening the CSV file open it with Excel, and this stops Excel from trimming the number. However, it's wreaking havoc with ADO, as it will return a recordset with nothing but headers and equal signs. If I take out the equal sign, it returns a fully functional populated recordset.

I cannot modify the way the reports are generated. I do not want to have to preprocess the file to remove equal signs unless I REALLY have to, as this is a file with thousands and thousands of rows.

Any thoughts on getting the ADO API to properly process the fields with = in them?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top