473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Connection string for Piped Delimiter CSV

Yan
hi,
I need to connect a csv file as data source. the connection string currently
using is

cnxStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + CSVFolder +
";Extended Properties=""Text;HDR=No;FMT=Delimited;IMEX=1\"""

it's working, however it's only able to read a row as one column. I have
multiple columns in a row, delimited by pipe (|). What's the variables i need
to add/change to the connection string in order for it to be able to come out
with a multiple columns datatable.

Thanks

Nov 21 '05 #1
5 12080
"Yan" <Ya*@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com...
hi,
I need to connect a csv file as data source. the connection string currently
using is

cnxStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + CSVFolder +
";Extended Properties=""Text;HDR=No;FMT=Delimited;IMEX=1\"""

it's working, however it's only able to read a row as one column. I have
multiple columns in a row, delimited by pipe (|). What's the variables i need
to add/change to the connection string in order for it to be able to come out
with a multiple columns datatable.

Thanks


You may need to include a schema.ini file to specify the custom delimiter. Have a look at
http://msdn.microsoft.com/library/de...a_ini_file.asp
and specifically "Custom Delimited." This may work in the connection string, but I have never tried it.

--

Al Reid
Nov 21 '05 #2
The Microsoft Text Driver is the slowest CSV parser going. You should
atleast switch to using the Jet driver.

http://www.geocities.com/shriop/csv_benchmarks.html

Al Reid wrote:
"Yan" <Ya*@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com...
hi,
I need to connect a csv file as data source. the connection string currently
using is

cnxStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + CSVFolder +
";Extended Properties=""Text;HDR=No;FMT=Delimited;IMEX=1\"""

it's working, however it's only able to read a row as one column. I have
multiple columns in a row, delimited by pipe (|). What's the variables i need
to add/change to the connection string in order for it to be able to come out
with a multiple columns datatable.

Thanks


You may need to include a schema.ini file to specify the custom delimiter. Have a look at
http://msdn.microsoft.com/library/de...a_ini_file.asp
and specifically "Custom Delimited." This may work in the connection string, but I have never tried it.

--

Al Reid


Nov 21 '05 #3
On Thu, 23 Jun 2005 07:27:05 -0400, "Al Reid" <ar*****@reidDASHhome.com> wrote:

¤ "Yan" <Ya*@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com...
¤ > hi,
¤ > I need to connect a csv file as data source. the connection string currently
¤ > using is
¤ >
¤ > cnxStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + CSVFolder +
¤ > ";Extended Properties=""Text;HDR=No;FMT=Delimited;IMEX=1\"""
¤ >
¤ > it's working, however it's only able to read a row as one column. I have
¤ > multiple columns in a row, delimited by pipe (|). What's the variables i need
¤ > to add/change to the connection string in order for it to be able to come out
¤ > with a multiple columns datatable.
¤ >
¤ > Thanks
¤ >
¤
¤ You may need to include a schema.ini file to specify the custom delimiter. Have a look at
¤ http://msdn.microsoft.com/library/de...a_ini_file.asp
¤ and specifically "Custom Delimited." This may work in the connection string, but I have never tried it.

The connection string doesn't support custom delimiters so a schema.ini file must be used, as you
mentioned.

[Test.csv]
ColNameHeader=False
CharacterSet=ANSI
Format=Delimited(|)
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #4
Yan
does Jet driver support Pipe delimiter? Can it use scheme.ini as well?

"shriop" wrote:
The Microsoft Text Driver is the slowest CSV parser going. You should
atleast switch to using the Jet driver.

http://www.geocities.com/shriop/csv_benchmarks.html

Al Reid wrote:
"Yan" <Ya*@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com...
hi,
I need to connect a csv file as data source. the connection string currently
using is

cnxStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + CSVFolder +
";Extended Properties=""Text;HDR=No;FMT=Delimited;IMEX=1\"""

it's working, however it's only able to read a row as one column. I have
multiple columns in a row, delimited by pipe (|). What's the variables i need
to add/change to the connection string in order for it to be able to come out
with a multiple columns datatable.

Thanks


You may need to include a schema.ini file to specify the custom delimiter. Have a look at
http://msdn.microsoft.com/library/de...a_ini_file.asp
and specifically "Custom Delimited." This may work in the connection string, but I have never tried it.

--

Al Reid


Nov 21 '05 #5

"Yan" <Ya*@discussions.microsoft.com> wrote in message news:59**********************************@microsof t.com...
does Jet driver support Pipe delimiter? Can it use scheme.ini as well?


Yes.
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Christopher Benson-Manica | last post by:
The function in question follows: vector<string>& tokenize( const string& s, vector<string>& v, char delimiter=',' ) { int delim_idx, begin_idx=0, len=s.length(); for(...
3
by: Old Wolf | last post by:
Hi all. G++ fails to compile the following: #include <string> int main() { std::string foo("abc=123"); std::string::const_iterator delimiter = std::find(foo.begin(), foo.end(), '=');
2
by: rmartin | last post by:
I need to conect my software from a remote client to a server, my standard connection: Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=;Initial Catalog=MyDb;Data...
5
by: Adam Parkin | last post by:
Hello all, I am seeking some help with the following problem. I'm working on an application where I have a resource file, and in this resource file what I want to store is a list of file names...
6
by: Webgour | last post by:
How to go from string "abc" to string "a|b|c"?
3
by: Rico | last post by:
If there are consecutive occurrences of characters from the given delimiter, String.Split() and Regex.Split() produce an empty string as the token that's between such consecutive occurrences. It...
10
by: Jon | last post by:
I want to count the number of instances of a certain string(delimiter) in another string. I didn't see a function to do this in the framework (if there is, please point me to it). If not, could...
35
by: Cor | last post by:
Hallo, I have promised Jay B yesterday to do some tests. The subject was a string evaluation that Jon had send in. Jay B was in doubt what was better because there was a discussion in the C#...
1
by: kellysgirl | last post by:
Now what you are going to see posted here is both the set of instructions I was given..and the code I have written. The instructions I was given are as follows In this case, you will create...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.