473,659 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange Excel importing problem

I have a routine that imports a list of part numbers into a dataview:

strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
cnnExcel = New OleDbConnection (strExcel)
da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
da.Fill(ds, "Excel")
dv = New DataView(ds.Tab les("Excel"))

This works fine exept when the following condition happens: The part
numbers are alpha-numeric. When a numeric only part number (mixed in with
alpha's) is read in, NULL is stored. The routine will read in numeric
values ONLY when all the part numbers in the spreadsheet are numeric.

I've tried formatting the column in the spreadsheet as Text to try and trick
the routine, with no luck.

Any suggestions? Thanks
Nov 21 '05 #1
5 2825
Take a look at this site:
http://www.connectionstrings.com/

There is another papramer to add in to the connection string to make certain
Excel treats intermeixed columns as text.

"Rob T" wrote:
I have a routine that imports a list of part numbers into a dataview:

strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
cnnExcel = New OleDbConnection (strExcel)
da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
da.Fill(ds, "Excel")
dv = New DataView(ds.Tab les("Excel"))

This works fine exept when the following condition happens: The part
numbers are alpha-numeric. When a numeric only part number (mixed in with
alpha's) is read in, NULL is stored. The routine will read in numeric
values ONLY when all the part numbers in the spreadsheet are numeric.

I've tried formatting the column in the spreadsheet as Text to try and trick
the routine, with no luck.

Any suggestions? Thanks

Nov 21 '05 #2
Works great! Thanks!

"Darrell Wesley" <Da***********@ discussions.mic rosoft.com> wrote in message
news:42******** *************** ***********@mic rosoft.com...
Take a look at this site:
http://www.connectionstrings.com/

There is another papramer to add in to the connection string to make
certain
Excel treats intermeixed columns as text.

"Rob T" wrote:
I have a routine that imports a list of part numbers into a dataview:

strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
cnnExcel = New OleDbConnection (strExcel)
da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
da.Fill(ds, "Excel")
dv = New DataView(ds.Tab les("Excel"))

This works fine exept when the following condition happens: The part
numbers are alpha-numeric. When a numeric only part number (mixed in
with
alpha's) is read in, NULL is stored. The routine will read in numeric
values ONLY when all the part numbers in the spreadsheet are numeric.

I've tried formatting the column in the spreadsheet as Text to try and
trick
the routine, with no luck.

Any suggestions? Thanks

Nov 21 '05 #3
Perhaps I spoke a bit too soon.... that part works, but now all my date
fields are returned as an integer. Any way to convert these back to a date
type?

"Darrell Wesley" <Da***********@ discussions.mic rosoft.com> wrote in message
news:42******** *************** ***********@mic rosoft.com...
Take a look at this site:
http://www.connectionstrings.com/

There is another papramer to add in to the connection string to make
certain
Excel treats intermeixed columns as text.

"Rob T" wrote:
I have a routine that imports a list of part numbers into a dataview:

strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
cnnExcel = New OleDbConnection (strExcel)
da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
da.Fill(ds, "Excel")
dv = New DataView(ds.Tab les("Excel"))

This works fine exept when the following condition happens: The part
numbers are alpha-numeric. When a numeric only part number (mixed in
with
alpha's) is read in, NULL is stored. The routine will read in numeric
values ONLY when all the part numbers in the spreadsheet are numeric.

I've tried formatting the column in the spreadsheet as Text to try and
trick
the routine, with no luck.

Any suggestions? Thanks

Nov 21 '05 #4
What your probably seing is the numeric value of the date field , if it is
then all you need to do is convert it back to a date in your VB program.

"Rob T" wrote:
Perhaps I spoke a bit too soon.... that part works, but now all my date
fields are returned as an integer. Any way to convert these back to a date
type?

"Darrell Wesley" <Da***********@ discussions.mic rosoft.com> wrote in message
news:42******** *************** ***********@mic rosoft.com...
Take a look at this site:
http://www.connectionstrings.com/

There is another papramer to add in to the connection string to make
certain
Excel treats intermeixed columns as text.

"Rob T" wrote:
I have a routine that imports a list of part numbers into a dataview:

strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
cnnExcel = New OleDbConnection (strExcel)
da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
da.Fill(ds, "Excel")
dv = New DataView(ds.Tab les("Excel"))

This works fine exept when the following condition happens: The part
numbers are alpha-numeric. When a numeric only part number (mixed in
with
alpha's) is read in, NULL is stored. The routine will read in numeric
values ONLY when all the part numbers in the spreadsheet are numeric.

I've tried formatting the column in the spreadsheet as Text to try and
trick
the routine, with no luck.

Any suggestions? Thanks


Nov 21 '05 #5
Guys... Excuse me for jumping in, but I have exactly Rob T's problem, and
have done what Darrell suggested with success. The integer returned seems to
represent the number of days from a reference day, which I calculated to
12/30/1899. That is, an Excel table cell that contains '7/4/2005' returns
the integer 38537. If your reference date is: dt =
DateTime.Parse( '12/30/1899'), then dt.AddDays(3853 7) is '7/4/2005' which is
correct. But... isn't it a bit odd that 12/31/1899 (the last day of the
century) is not used? Am I missing something? Thanks! Tom Stanley
"Darrell Wesley" wrote:
What your probably seing is the numeric value of the date field , if it is
then all you need to do is convert it back to a date in your VB program.

"Rob T" wrote:
Perhaps I spoke a bit too soon.... that part works, but now all my date
fields are returned as an integer. Any way to convert these back to a date
type?

"Darrell Wesley" <Da***********@ discussions.mic rosoft.com> wrote in message
news:42******** *************** ***********@mic rosoft.com...
Take a look at this site:
http://www.connectionstrings.com/

There is another papramer to add in to the connection string to make
certain
Excel treats intermeixed columns as text.

"Rob T" wrote:

> I have a routine that imports a list of part numbers into a dataview:
>
> strExcel = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
> boxFile.Text & ";Extended Properties=""Ex cel 8.0;HDR=NO"""
> cnnExcel = New OleDbConnection (strExcel)
> da = New OleDbDataAdapte r("Select * from [ODRJYUFI$]", cnnExcel)
> da.Fill(ds, "Excel")
> dv = New DataView(ds.Tab les("Excel"))
>
> This works fine exept when the following condition happens: The part
> numbers are alpha-numeric. When a numeric only part number (mixed in
> with
> alpha's) is read in, NULL is stored. The routine will read in numeric
> values ONLY when all the part numbers in the spreadsheet are numeric.
>
> I've tried formatting the column in the spreadsheet as Text to try and
> trick
> the routine, with no luck.
>
> Any suggestions? Thanks
>
>
>


Nov 21 '05 #6

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

Similar topics

1
3198
by: Richard Holliingsworth | last post by:
Hello: Thanks for your quick response. I'm trying to import a new Excel file into an A2K table and it's truncating the data. One of the Excel columns is a text field that can be up to 2000 characters. When I import it into A2K, that field is truncated. If I try to inport the file into an EXISTING table that I define myself where that field is a MEMO field, the import crashes.
10
1927
by: Arno R | last post by:
Hi all Yesterday I found a strange corruption-issue that I can't solve yet or actually point my finger at. I converted an A97 app to A2k. I have done this often enough so I didn't expect trouble here. Conversion seems OK and I start the app. BUT . . . Mainform doesn't work. Form comes up but none of the buttons react. Why not? I go to design view and see that code is not compiled. (compile-option is active) So I compile and go to normal...
1
2451
by: Geoff Jones | last post by:
Hi I have a question which I hope somebody can answer. I have written a VB application with which I want to import an Excel file, analyze the data within it and do some calculations. There are in fact five sheets in the Excel file. My original idea was to import the file into access and create a database file; which I did and worked beautifully. It generated five tables in the database as expected. However, I then thought why not...
2
10047
by: jereviscious | last post by:
Hi all - Last resort time. I'm importing data from a spreadsheet that I receive from one of my vendor using interop.excel. The date field in excel is entered as 4/7/2006, but when I retrieve the value, it returns a double 38449.0. I can't figure out how to convert this value into a proper date. I have no Idea what excel is doing with this date. Also, when I enter in 38449 into
2
3490
by: madeleine | last post by:
I'm hoping the answer to this is that I'm just doing something silly, but I'm really scratching my head over this one. I'm importing data from multiple workbooks, each workbook has a sheet called SubSAT and I need to get specific data from that into the database. I'm finding that if I have the workbook open on my desktop then the SubSAT % complete and the High level plan % come in fine, but as soon as the workbook is closed they come...
6
2766
by: Michael Peters | last post by:
the Excel data that I would like to import into Access sometimes contain line breaks, like this: 623 749 in one cell. In Access, the imported data looks like this then: 623749
2
1915
by: ScardyBob | last post by:
Hello, I am having trouble importing data from an Excel Worksheet. When I try to import the data, everything works except certain columns that contain dates, where it replaces the date with a null in the access table. To import the data I do the following. 1. Create a table based on the excel spreadsheet setup with the following query sSQL = "INSERT INTO " & TblName & " SELECT * " _
7
12060
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
1602
by: James Minns | last post by:
Hi all, I have a problem with Excel 2007: it crashes when importing certain xml data, exported from another software This is the smallest file which reproduces the problem: <?xml version="1.0" standalone="yes"?> <ds_S3 xmlns="http://tempuri.org/ds_S3.xsd"> <tblTags> <StartDateAndTime>2000-01-01T00:00:00+01:00</StartDateAndTime> </tblTags>
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.