Reading CSV file with ODBC Text Driver and Retain Field Format

I am using the MS ODBC text driver to read a CSV file.  My logic is fairly dynaminc in that I do not know the number of fields or their format before-hand.  I would like to read the fields in as text fields so the formatting in the csv file is retained.  My problem is that I have a field that is being interpreted as a numeric field and the leading zeroes are being dropped.  For example, '0403100' is being read in as '403100'.   Again, I don't know which field in the table this will be.  I simply want to read the field in as a text field retaining all formatting in the file.  I can not save the CSV file with quotes around the fields either.  Any ideas?
AddOnsIncAsked:
Who is Participating?
 
Anthony PerkinsCommented:
If you do not know the format ahead of time, consider opening the file as a standard text file and looping through all the rows.  You can then use the Split funciton to get all the values.
0
 
leonstrykerCommented:
You will need to create a schema.ini file and specify column data type as text.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp

Leon
0
 
Anthony PerkinsCommented:
Please take the time to re-read the EE Guidelines regarding grading at:
What's the right grade to give?
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Databases/help.jsp#hi73

And in particular this section:
<quote>
C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.
Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support. It's also true that a "C" is the lowest grade you can give, and the Experts know that -- so use it judiciously.

... Similarly, the C grade is the lowest that can be given by a member, a fact which should be kept in mind when grading as well.

The use of a C in a vindictive manner is likely to be changed by a Moderator. You may not like the answer you get, and in some cases, and you may not like the way it is delivered, but if it is deemed to be accurate, no less than a B is an acceptable grade.

</quote>

Also this link:

Can I get a grade changed?
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Databases/help.jsp#hs5
0
 
Anthony PerkinsCommented:
Do you have any comments?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.