TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nishant ranjan
NA
390
0
error in reading datetime value from excel to datatable
Aug 2 2013 5:27 AM
rollno formno citycode firstname lastname fathername gender dob centrecode examdate
53303 1 9 abc xyz pqr m 12/13/1995 9003 07/07/2013
the above data is in excel file.
while (RowIndex <= ShtRange.Rows.Count)
{
ColIndex = 0;
ColFrom = ColFrm;
if (RowIndex > 1)
{
dtExcel.Rows.Add();
while (ColFrom <= ColTo)
{
if ((ShtRange.Cells[RowIndex, ColFrom] as Excel.Range).Value2 != null)
dtExcel.Rows[dtExcel.Rows.Count - 1][ColIndex] = (ShtRange.Cells[RowIndex, ColFrom] as Excel.Range).Value2.ToString();
//error occures here
ColIndex++;
ColFrom++;
}
}
RowIndex++;
dtexcel is datatable
when starting reading value from excel file, then value till gender are inserted into datatable but when it reads dob then error occurs that "string was not recognized as valid datetime. couldnot store <35046> in dob column. Expected type is date time.
plz note dob column in dtexcel is of datetime
what is the error in above code? what is couldnot store <35046> in dob column error? from where this value is coming.
Reply
Answers (
14
)
delete event not working
Application Error