|
|
 |
| ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

October 16th, 2007, 01:27 AM
|
|
Authorized User
|
|
Join Date: Jul 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
problem in reading excel data
Hi All,
I have a problem in reading the excel data.
In the excel sheet I have column named "EmpCode"
and it has values like 234,177,478,202,9033,9023,
733,4890,RC392,RC922,RC738, etc.
When I read the excel data using ASP.NET, I was able to
read only the interger values.
The string values like RC392, RC922,....
are unable to read.
In the excel the "EmpCode" has "general" type.
I have also tried with "Text" type and "value" type
but could not achieve the result.
Can any one help me to sort this problem
|

October 16th, 2007, 04:52 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Location: , , India.
Posts: 547
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Can you let us know how you are trying to access the data from the Excel sheet, may be then we will be able to help you out!!!
Regards
Mike
|

October 17th, 2007, 05:21 AM
|
|
Authorized User
|
|
Join Date: Jul 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I have tried with two approaches.
One is by using "Import and Export data" wizard of sql server.
Second is by using OleDbSchemaTable in my ASP.NET application.
Both the approach does not give the desired result.
What I suspect is that, based on the data from the first 6 to 7 rows
in the excel sheet the datatype for the column in excel is decided.
Consider for example I have got 10 rows in a sheet.
First 8 rows has numeric value and last 2 rows has alphanumeric value. When I export the sheet using "Import and Export data wizard"
or read the data using OleDbSchemaTable in my ASP.NET application,
I could get the exact values for the first 8 rows and for the remaining 2 rows I could not get the values.
|

October 17th, 2007, 09:56 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
|
|
Doesn't know exactly how the wizard works, but I know that access import wizard do exactly that, take the firsts 5 rows to get the data type of the column... so maybe is the same???
You can do 2 things: insert a dummy row at the top of the table, or just mixed the rows so the wizard will take every column as varchar...
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
|

October 18th, 2007, 06:02 AM
|
|
Authorized User
|
|
Join Date: Jul 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Thanks for your ideas. I will try with your ideas and sort out the problem.
|

October 22nd, 2007, 11:14 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
for reading in excel, also check out this link:
http://dailydoseofexcel.com/archives...ed-data-types/
There are a few hangups everyone experiences and it sounds like you're already on the right track. The jet driver defaults to reading in the first 8 rows of data, and determines a data type based on that. What you want to usually do is override that and force it to use the mixed data type for columns with varchar-like data.
If you don't need a program to do this, you should definitely just use SQL Server. SQL Server 2005 makes it pretty easy. 2000's DTS is not as easy but you'll figure it out....
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |