ASP.NET using Excel as a datasource

I'm working on an application that uses an Excel spreadsheet to temporarily populate a gridView.  Everything works fine except one single column that displays an ID.  The format for this ID is P12345, with every entry having a 'P' at the beginning of it.  For whatever reason, this field won't show up in the gridView.  If I go into the data and delete the P, shows up fine, otherwise it won't.  Anyone else run into this?  
stretch73Asked:
Who is Participating?
 
Ken ButtersConnect With a Mentor Commented:
No ... what I mean is.... do you have the same result with an "A" or a "B" or a "C" as you do a "P".  My thought being is that somewhere along the line in your code, you are assigning the value to a numeric variable.  Something along those lines could cause the variable assignment to fail, resulting in no display of the ID.  

Extending my first question.... if you put ANY letter in ANY position of the ID field... does it still show up as blank?

Do you have code anywhere that defines the ID field as numeric? or integer? or long? etc....
0
 
Ken ButtersCommented:
With the removal of the 'P' the value could be interpreted as in numeric.   Does the error only happen with 'P' or will any non-numeric cause the same problem?
0
 
stretch73Author Commented:
It only happens with the P.  If I take the P off, the remaining number is displayed.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
MattiCommented:
Hi!

Link the  Excel table into an Access MDB and access that form ASP.
Excel will have some format problems, so maybe you need a sub for filter it before display, In my knowledge linking data to mdb will remove this problem.

Matti
0
 
stretch73Author Commented:
Okay, I've made a little progress.  It looks like, for whatever reason, the field is being read in as a a DBNULL.  I started to do a manual import into SQL Server, just to see what the mappings would say, and the default type on the field when I'm pulling it in is set to float.  It's like it wants it to be a number but since it has an alpha character it doesn't know what to do with it once it gets there.
0
 
stretch73Author Commented:
Thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.