-
Dec 9th, 2008, 09:14 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] connection string to .CSV
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & ";Extended Properties=""text;HDR=No;FMT=Delimited( ; )"""
i see data .. but the seperation by semicolon is not working .. what do i need to change?
(extra spaces for ; .. cause of smilies)
Last edited by Amien; Dec 9th, 2008 at 09:49 AM.
-
Dec 9th, 2008, 09:51 AM
#2
Re: connection string to .CSV
Do you mean that you file is actually semi-colon delimited instead of comma?
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 9th, 2008, 09:57 AM
#3
Thread Starter
Hyperactive Member
Re: connection string to .CSV
yes .. my file has a semi-colon in it ( ; )
-
Dec 9th, 2008, 10:03 AM
#4
Fanatic Member
Re: connection string to .CSV
Have you tried this?
Code:
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & ";Extended Properties=""text;HDR=Yes;FMT=Delimited;"""
I am not sure if you are aware of this site or not:
http://www.connectionstrings.com/textfile
Good Luck and hope this helps!
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
-
Dec 9th, 2008, 10:06 AM
#5
Thread Starter
Hyperactive Member
Re: connection string to .CSV
yes .. tried it .. not working
when i change the layout from ; to , .. then its working .. but i really need a ; and not a ,
-
Dec 9th, 2008, 10:18 AM
#6
Thread Starter
Hyperactive Member
Re: connection string to .CSV
found it ..
need to create a schema.ini file .. on the same location .. containting:
[test.CSV]
ColNameHeader=False
CharacterSet=ANSI
Format=Delimited( ; )
-
Dec 9th, 2008, 10:20 AM
#7
Fanatic Member
Re: connection string to .CSV
Cool, good job! Where did you find that info? And dont forget to mark the issue resolved!!
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
-
Dec 9th, 2008, 10:21 AM
#8
Re: connection string to .CSV
Don't use ADO.Net in your case then. With ADO.Net, it uses the system's default delimiter and unless you've changed it, that default delimiter is the comma. You can change it in registry, but I strongly suggest that you DON'T do it. You can also create a schema for the file, but it needs to be in the same folder as the file, and if you have many of those delimited files to parse, it's going to be very tedious to create the schemas for them all.
Instead, have a look at the TextFieldParser class which you can set its Delimiters property to tell the object what the delimiters are in the file.
Last edited by stanav; Dec 9th, 2008 at 10:24 AM.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 9th, 2008, 10:47 AM
#9
Thread Starter
Hyperactive Member
Re: connection string to .CSV
found it on google somewhere .. i thought .. this is never gonna work .. but i was kind of desperate 
Thanks for the tip stanav .. might look into that TextFieldParser..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|