ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem when programatically importing cell that contain numbers and text (https://www.excelbanter.com/excel-programming/319209-problem-when-programatically-importing-cell-contain-numbers-text.html)

Trond Hindenes

Problem when programatically importing cell that contain numbers and text
 
Hello all,

I am experiencing a strange problem when trying to import data from an
Excel file using vb.net (using the OLE DB provider):

I have a column that in some cases store a number, f.ex. '789' and in
some cases a combination of numbers and letters, f.ex 'T33'.

It seems that when importing, either using the import function in SQL
Server or the JET OLE DB provider, this doesn't work (or maybe its
me...)

Whenever the majority (it seems) of the rows has only a number in that
column, the numerical values are imported, and the text values are
just xeroed out. ALso, when I use textual values for most of the rows
and a few numerical values, it is the numerical ones that are zeroed
out and not imported.

As far as I can see, the JET engine tries to determine the datatype in
each column, and has a hard time determening when there are
combinations of numbers and letters.

Has anyone else experienced this? Any workaround?

Best regards,
Trond Hindenes
Norway

Tom Ogilvy

Problem when programatically importing cell that contain numbers and text
 
A discussion by Jamie Collins:
http://www.dicks-blog.com/archives/2...ed-data-types/

--
Regards,
Tom Ogilvy



"Trond Hindenes" wrote in message
om...
Hello all,

I am experiencing a strange problem when trying to import data from an
Excel file using vb.net (using the OLE DB provider):

I have a column that in some cases store a number, f.ex. '789' and in
some cases a combination of numbers and letters, f.ex 'T33'.

It seems that when importing, either using the import function in SQL
Server or the JET OLE DB provider, this doesn't work (or maybe its
me...)

Whenever the majority (it seems) of the rows has only a number in that
column, the numerical values are imported, and the text values are
just xeroed out. ALso, when I use textual values for most of the rows
and a few numerical values, it is the numerical ones that are zeroed
out and not imported.

As far as I can see, the JET engine tries to determine the datatype in
each column, and has a hard time determening when there are
combinations of numbers and letters.

Has anyone else experienced this? Any workaround?

Best regards,
Trond Hindenes
Norway





All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com