BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TXT delimited (;) filles problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Luka
Guest





PostPosted: Mon May 14, 2007 8:10 am    Post subject: TXT delimited (;) filles problem Reply with quote



I'm connecting to several txt files delimited with ";".
They are all the same format (columns, rows and data), but on one file there
is an error.
The data in one column is:

row 1: 83,07
row 2: 11,57
row 3: 6,22
row 4: 0

but delphi sees it as date:

row 1:
row 2: 30.12.1899 11:57:00
row 3: 30.12.1899 6:22:00
row 4: 30.12.1899

Why am I getting it as date? Is there any way to force it to see it as
number?
Back to top
Vassiliev V. V.
Guest





PostPosted: Mon May 14, 2007 3:32 pm    Post subject: Re: TXT delimited (;) filles problem Reply with quote



At first, how do you connect to these files? Probably with ADO because you
write into this newsgroup, but more information is needed.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"Luka" <luka.matijevic (AT) presoflex (DOT) hr> сообщил/сообщила в новостях следующее:
news:4648081c (AT) newsgroups (DOT) borland.com...
Quote:
I'm connecting to several txt files delimited with ";".
They are all the same format (columns, rows and data), but on one file
there is an error.
The data in one column is:

row 1: 83,07
row 2: 11,57
row 3: 6,22
row 4: 0

but delphi sees it as date:

row 1:
row 2: 30.12.1899 11:57:00
row 3: 30.12.1899 6:22:00
row 4: 30.12.1899

Why am I getting it as date? Is there any way to force it to see it as
number?



Back to top
Luka
Guest





PostPosted: Mon May 14, 2007 5:30 pm    Post subject: Re: TXT delimited (;) filles problem Reply with quote



adoquery1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=g:\temp+';Extended Properties=''text;FMT=Delimited''';

it works fine with all but one txt file, and they are basicly the same, just
diferent data, same format



"Vassiliev V. V." <support (AT) oledbdirect (DOT) com> wrote in message
news:46483ad3 (AT) newsgroups (DOT) borland.com...
Quote:
At first, how do you connect to these files? Probably with ADO because you
write into this newsgroup, but more information is needed.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"Luka" <luka.matijevic (AT) presoflex (DOT) hr> сообщил/сообщила в новостях
следующее: news:4648081c (AT) newsgroups (DOT) borland.com...
I'm connecting to several txt files delimited with ";".
They are all the same format (columns, rows and data), but on one file
there is an error.
The data in one column is:

row 1: 83,07
row 2: 11,57
row 3: 6,22
row 4: 0

but delphi sees it as date:

row 1:
row 2: 30.12.1899 11:57:00
row 3: 30.12.1899 6:22:00
row 4: 30.12.1899

Why am I getting it as date? Is there any way to force it to see it as
number?





Back to top
Del Murray
Guest





PostPosted: Mon May 14, 2007 6:08 pm    Post subject: Re: TXT delimited (;) filles problem Reply with quote

Is this the only input file that has a "comma" in the number ???
Back to top
Chris.Cheney
Guest





PostPosted: Mon May 14, 2007 7:28 pm    Post subject: Re: TXT delimited (;) filles problem Reply with quote

"Luka" <luka.matijevic (AT) presoflex (DOT) hr> wrote in
news:46485631$1 (AT) newsgroups (DOT) borland.com:

Quote:
adoquery1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=g:\temp+';Extended Properties=''text;FMT=Delimited''';

Is there a g:\temp\schema.ini file? If so, what does it contain?

Chris

Quote:
it works fine with all but one txt file, and they are basicly the
same, just diferent data, same format



"Vassiliev V. V." <support (AT) oledbdirect (DOT) com> wrote in message
news:46483ad3 (AT) newsgroups (DOT) borland.com...
At first, how do you connect to these files? Probably with ADO
because you write into this newsgroup, but more information is
needed.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"Luka" <luka.matijevic (AT) presoflex (DOT) hr> сообщил/сообщила в новостях
следующее: news:4648081c (AT) newsgroups (DOT) borland.com...
I'm connecting to several txt files delimited with ";".
They are all the same format (columns, rows and data), but on one
file there is an error.
The data in one column is:

row 1: 83,07
row 2: 11,57
row 3: 6,22
row 4: 0

but delphi sees it as date:

row 1:
row 2: 30.12.1899 11:57:00
row 3: 30.12.1899 6:22:00
row 4: 30.12.1899

Why am I getting it as date? Is there any way to force it to see it
as number?







Back to top
John Herbster
Guest





PostPosted: Tue May 15, 2007 3:53 am    Post subject: Re: TXT delimited (;) filles problem Reply with quote

"Luka" <luka.matijevic (AT) presoflex (DOT) hr> wrote
Quote:
... it works fine with all but one txt file, and they are
basically the same, just different data, same format ...

Luka,
Then show us the content of the file around the point
of the problem in hexadecimal or equivalent. This
will help us help you.
Rgds, JohnH
Back to top
Luka
Guest





PostPosted: Tue May 15, 2007 8:11 am    Post subject: Re: TXT delimited (;) filles problem Reply with quote

I found the answer to my problem, adding IMEX=1 to the connection string
tells the query to interprete all the data as text. And then I convert
string to number with strtofloat();

The connection string then looks like this:

adoquery1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=g:\temp+';Extended Properties=''text;FMT=Delimited; IMEX=1''';

To answer Del, all the files have numbers with comma;
To answer Chris, schema.ini file is needed if the text file is TAB
delimited, and when delimiter is comma, or some other symbol (like Wink it is
not needed.

Thanx everyone for replays, maybe this solution will help you all at some
point

Luka


"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote in message
news:4648e7f9 (AT) newsgroups (DOT) borland.com...
Quote:

"Luka" <luka.matijevic (AT) presoflex (DOT) hr> wrote
... it works fine with all but one txt file, and they are
basically the same, just different data, same format ...

Luka,
Then show us the content of the file around the point
of the problem in hexadecimal or equivalent. This
will help us help you.
Rgds, JohnH



Back to top
Chris.Cheney
Guest





PostPosted: Tue May 15, 2007 1:07 pm    Post subject: Re: TXT delimited (;) filles problem Reply with quote

"Luka" <luka.matijevic (AT) presoflex (DOT) hr> wrote in
news:4649437c (AT) newsgroups (DOT) borland.com:

Quote:
I found the answer to my problem, adding IMEX=1 to the connection
string tells the query to interprete all the data as text. And then I
convert string to number with strtofloat();

The connection string then looks like this:

adoquery1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=g:\temp+';Extended Properties=''text;FMT=Delimited; IMEX=1''';

To answer Del, all the files have numbers with comma;
To answer Chris, schema.ini file is needed if the text file is TAB
delimited, and when delimiter is comma, or some other symbol (like Wink
it is not needed.

Thanks for the IMEX information - I am glad you have solved the problem.
IFAICT this does not seem to be documented by MS with respect to text
import (however, http://support.microsoft.com/kb/194124/EN-US/ describes
IMEX for import from Excel).

BTW, in my experience, the effect of changing the delimiter in a file
that successfully imports without a schema.ini from comma to semicolon
was to require a schema.ini specifying for that file

format=delimiter(;)

YMMV.

Quote:
Thanx everyone for replays, maybe this solution will help you all at
some point

Luka


"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote in message
news:4648e7f9 (AT) newsgroups (DOT) borland.com...

"Luka" <luka.matijevic (AT) presoflex (DOT) hr> wrote
... it works fine with all but one txt file, and they are
basically the same, just different data, same format ...

Luka,
Then show us the content of the file around the point
of the problem in hexadecimal or equivalent. This
will help us help you.
Rgds, JohnH





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.