Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error During update datagrid

Status
Not open for further replies.

123ASP

MIS
Nov 2, 2002
239
0
0
US
hi, I have a datagrid that contain a date field. if the field has a adate before I update the row, it make the update, but if a edit a record that has no date in the column field, I get the following error, any idea how to fix it.

thanks Al
Cast from type 'DBNull' to type 'Date' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'Date' is not valid.

Source Error:
Line 64: vinitialcontact =dr("initialcontact")
Line 65: vfollowup= dr("followup")
Line 66:vnextfollowupdate = dr("nextfollowupdate")
Line 67:end while


 
123: My initial guess when I read this a day or two ago was that you would have to, in code behind, prevent the NULL from being read in the first place, some type of Not DBIsNull type of statement. Any luck on this problem?
 
Hi! 123ASP,
Did you get a solution to your problem.
I am facing the same issue, and would like to know how you got it working.
Thanks
 
Actually, I was in a car accident and was hurt. Did not have the time to fix the issue. If you already have the answer,I would appreciate to share it with me.
thanks

Al
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top