Server Error in '/' Application.

Conversion 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: Conversion from type 'DBNull' to type 'Date' is not valid.

Source Error:


Line 170:            ' EJB 1/15/2012 -  Item Publication Date to the date/time the listing was run per RSS specifications at:
Line 171:            ' http://www.rssboard.org/rss-specification#ltpubdategtSubelementOfLtitemgt
Line 172:            listingDateTimeRun = DBReader("PublicationDate")
Line 173:            listingDateTimeRunrfc822DateString = listingDateTimeRun.ToString("r")
Line 174:            XMLOutput.WriteElementString("pubDate", listingDateTimeRunrfc822DateString)

Source File: E:\web\oliveind\Controls\ArticlesRSSOutput.ascx.vb    Line: 172

Stack Trace:


[InvalidCastException: Conversion from type 'DBNull' to type 'Date' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(Object Value) +456024
   Controls_ArticlesRSSOutput.Page_Load(Object sender, EventArgs e) in E:\web\oliveind\Controls\ArticlesRSSOutput.ascx.vb:172
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0