|
-
Nov 6th, 2008, 02:21 PM
#1
Thread Starter
Addicted Member
[2005] Very strange Excel problem...
Ok,
I have a web application that reads in data from an Excel spreadsheet. Seems to work fine, but I'm getting some strange behavior from one of the Excel columns.
Here is the scenario:
A user uploads a spreadsheet, the app reads in the data from all the columns. On this particular column, called Relo, if there is at least one value for this column within the first few rows, the rest of the rows with a value for this column will be read as well. However, if there is no value in the column after the first few rows, I always get an empty string for the value in later rows, even if there is a legitimate value in the column.
Has anyone ever encountered this? I cannot for the life of me figure out what could be potentially causing this behavior.
Edit: Don't know if it matters any, but we're using Office 2003.
Last edited by Blakk_Majik; Nov 6th, 2008 at 02:26 PM.
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
-
Nov 6th, 2008, 03:10 PM
#2
PowerPoster
Re: [2005] Very strange Excel problem...
what connectionstring are you using?
-
Nov 6th, 2008, 03:42 PM
#3
Thread Starter
Addicted Member
Re: [2005] Very strange Excel problem...
I'm not sure what you mean.
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
-
Nov 6th, 2008, 03:44 PM
#4
PowerPoster
Re: [2005] Very strange Excel problem...
how are you connecting to excel to read data from it? What code do you have to do this?
-
Nov 6th, 2008, 05:02 PM
#5
Thread Starter
Addicted Member
Re: [2005] Very strange Excel problem...
Is this what you are referring to?
Dim objExcel As New OleDbCommand("SELECT * FROM [User_Upload$]", objConn)
Dim Excelreader As OleDbDataReader = objExcel.ExecuteReader()
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
-
Nov 6th, 2008, 05:21 PM
#6
PowerPoster
Re: [2005] Very strange Excel problem...
not quite... what is objConn. what value is that?
-
Nov 6th, 2008, 06:18 PM
#7
Thread Starter
Addicted Member
Re: [2005] Very strange Excel problem...
Well, we have discovered a solution.
At the end of the connection string, I put IMEX=1. I'm not completely satisfied with this though, since it declares everything on the spreadsheet as text (from what I've been told). Luckily all the app cares about is the values, not format, so we're in the clear this time.
Thanks for your help techno. Once I found the solution, it was then I finally figured out why you wanted me to show the connection string.
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
-
Nov 6th, 2008, 06:27 PM
#8
-
Nov 7th, 2008, 02:03 AM
#9
Re: [2005] Very strange Excel problem...
From what I know the problem could be caused because excell determines the dataType of each column from the first few entries in each column. This can be problematic as you discoverd.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|