473,394 Members | 1,645 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,394 software developers and data experts.

Exception creating csv file

International settings: Italian

Excecuting the following snippet

System.Data.OleDb.OleDbConnection Conn=new
System.Data.OleDb.OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\;Extended
Properties=\"text;HDR=Yes;FMT=Delimited\""
System.Data.OleDb.OleDbCommand Cmd = new
System.Data.OleDb.OleDbCommand("create table file1.csv ([column1]
char(255), [column2] char(255), [column3] char(255))"Cnn);
Cnn.Open();
Cmd.ExecuteNonQuery();

I got this exception:

[System.Data.OleDb.OleDbException]:
{"Text file specification field separator matches decimal separator or
text delimiter." }

If I set English as International Settings no exception occurs.

Dec 18 '06 #1
4 7985
Tommaso,

The reason this happens is probably because of your culture settings.
The culture settings for Italian probably use a comma as a decimal separator
for numbers, and it is getting confused.

You might have to parse the file by hand, since I don't know how to
override the culture settings for the driver in OLEDB.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tommaso Caldarola" <il********@lcimitero.itwrote in message
news:45**********@x-privat.org...
International settings: Italian

Excecuting the following snippet

System.Data.OleDb.OleDbConnection Conn=new
System.Data.OleDb.OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\;Extended
Properties=\"text;HDR=Yes;FMT=Delimited\""
System.Data.OleDb.OleDbCommand Cmd = new
System.Data.OleDb.OleDbCommand("create table file1.csv ([column1]
char(255), [column2] char(255), [column3] char(255))"Cnn);
Cnn.Open();
Cmd.ExecuteNonQuery();

I got this exception:

[System.Data.OleDb.OleDbException]:
{"Text file specification field separator matches decimal separator or
text delimiter." }

If I set English as International Settings no exception occurs.

Dec 18 '06 #2
On Mon, 18 Dec 2006 18:11:53 +0100, Tommaso Caldarola
<il********@lcimitero.itwrote:
>International settings: Italian

Excecuting the following snippet

System.Data.OleDb.OleDbConnection Conn=new
System.Data.OleDb.OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\;Extended
Properties=\"text;HDR=Yes;FMT=Delimited\""
System.Data.OleDb.OleDbCommand Cmd = new
System.Data.OleDb.OleDbCommand("create table file1.csv ([column1]
char(255), [column2] char(255), [column3] char(255))"Cnn);
Cnn.Open();
Cmd.ExecuteNonQuery();

I got this exception:

[System.Data.OleDb.OleDbException]:
{"Text file specification field separator matches decimal separator or
text delimiter." }

If I set English as International Settings no exception occurs.
It looks to me like the application is getting confused between the
Italian decimal separator ',' and the comma that separates the
variables when you are storing a double or a float. The solution may
well be to enclose the field in double quotes so the output is
"123,456", rather than 123,456, which is 123.456, in English which is
why it is OK.

This may mean setting up an extra column for each float/double field
and population it with '"' + 123,456.ToString() + '"' or something
similar.

rossum

Dec 18 '06 #3
Nicholas Paldino [.NET/C# MVP] wrote:
Tommaso,

The reason this happens is probably because of your culture settings.
The culture settings for Italian probably use a comma as a decimal separator
for numbers, and it is getting confused.

You might have to parse the file by hand, since I don't know how to
override the culture settings for the driver in OLEDB.

Update:

the problem occurs on SO english with Italian settings only
while on SO and settings both in English or Italian no problem.
Dec 19 '06 #4
Tommaso Caldarola wrote:
Update:

the problem occurs on SO english with Italian settings only
while on SO and settings both in English or Italian no problem.

Fixed. Just to provide in the destination folder a schema.ini file with these
settings:

CharacterSet=ANSI
CurrencyThousandSymbol=,
DecimalSymbol=.

Dec 19 '06 #5

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

Similar topics

0
by: Oliver | last post by:
Hello, (I posted about this a few weeks agao, but got no response. I've tried some more stuff since then...) I’ve written a Visual basic .NET program that need to create a new .DBF file...
4
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
14
by: Nenad Dobrilovic | last post by:
Hi, Is it possible for exception object to be aware of it's throwing? I want to log in the text file when exeption is thrown, not when the exception object is created (because I can create...
1
by: Peter Wullems | last post by:
I use C# to parse incoming emails for a predefined type and structure of message content and construct replies automatically, attach a file and place the generated emails in the drafts folder. ...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
2
by: Chris Stiefeling | last post by:
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger (debug or release)...
1
by: Chris Stiefeling | last post by:
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger I receive the...
0
by: Gabriel Genellina | last post by:
En Mon, 26 May 2008 05:31:27 -0300, <Dominique.Holzwarth@ch.delarue.comescribi: Don't inherit from Exception - you should be able to log *any* exception, not only this specific one, I presume?...
17
by: Cramer | last post by:
I plan to implement an exception logging feature in an ASP.NET Web application that writes encountered exceptions to disk. The exception data will be stored as XML. I am planning on having each...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.