conncetion string to CSV



I am using the following connection string:

junk = "Provider=Microsoft.Jet.OLEDB.4.0;"
junk &= "Data Source=\data;"
junk &= "Extended Properties=""text;HDR=No;FMT=Delimited"""

And this works fine on file that are comma delimited w/ quotes around
all fields. But I now have a file that is comma delimited and the quotes
are only around the alpha fields, not the number field. This connection
string is used it reads the numbers as zero:


The abc and abcdefg are read fine, the 1 is read fine, but the .0345 and
1.2345 are read as 0 and 1 respectively. Could this be because at the
beginning of the file the numbers have no decimal places
("abc","abcdefg",1,1,1) for the first 500 plus lines?


Terry Olsen

Have you created a Schema.ini file defining the field types? It would seem
that the fields are being interpreted as integers when they should be
interpreted as Char. Here is a sample schema.ini file that I have for one of
my CSV files...

Col1=datetime Char Width 255
Col2=s-sitename Char Width 255
Col3=s-ip Char Width 255
Col4=cs-method Char Width 255
Col5=cs-uri-stem Char Width 255
Col6=cs-uri-query Char Width 255
Col7=s-port Char Width 255
Col8=cs-username Char Width 255
Col9=c-ip Char Width 255
Col10=cs(user-agent) Char Width 255
Col11=sc-status Char Width 255
Col12=sc-substatus Char Width 255
Col13=sc-win32-status Char Width 255

Take a look here for a detailed explanation of schema.ini files:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question