PC Review


Reply
Thread Tools Rate Thread

conncetion string to CSV

 
 
Darin
Guest
Posts: n/a
 
      1st Jul 2007
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:

"abc","abcdefg",1.0,.0345,1.2345

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?

Darin

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Terry Olsen
Guest
Posts: n/a
 
      1st Jul 2007
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...

[IISLogViewerDb.csv]
ColNameHeader=True
Format=CSVDelimited
CharacterSet=ANSI
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:
http://msdn2.microsoft.com/en-us/library/ms709353.aspx

"Darin" <darin_nospam@nospamever> wrote in message
news:(E-Mail Removed)...
>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:
>
> "abc","abcdefg",1.0,.0345,1.2345
>
> 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?
>
> Darin
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Broadband conncetion =?Utf-8?B?RGllZ28=?= Windows XP Networking 7 11th Sep 2005 04:22 PM
Remote Conncetion =?Utf-8?B?TXIuIENoYXZkYQ==?= Windows XP Networking 0 25th Jun 2005 06:13 PM
Conncetion Drops Bob Microsoft Windows 2000 Terminal Server Clients 4 16th Mar 2004 07:16 PM
conncetion less DSN Mohan Microsoft Outlook Form Programming 1 27th Feb 2004 03:48 PM
Conncetion Sharing dwa Microsoft Windows 2000 Networking 0 4th Oct 2003 03:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 AM.