bkedersha Posted August 3, 2005 Posted August 3, 2005 A previous developer created this page using FrontPage 2003. I know you cannot have an empty dataset. Is there anyway around this problem in VB.net and aspt.net http://www.xtremedotnettalk.com/newthread.php?do=newthread&f=62# Confused Operator is not valid for type 'DBNull' and type 'Date'. 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: Operator is not valid for type 'DBNull' and type 'Date'. Source Error: Line 25: end select Line 26: if not page.ispostback Line 27: select case session("CurrentGrantExpDate") < now() Line 28: case true Line 29: lblNewExpDate.visible=false Source File: D:\GrantManagementWeb\TimeAmendmentForm.aspx Line: 27 Stack Trace: [invalidCastException: Operator is not valid for type 'DBNull' and type 'Date'.] Microsoft.VisualBasic.CompilerServices.ObjectType.ThrowNoValidOperator(Object obj1, Object obj2) +562 Microsoft.VisualBasic.CompilerServices.ObjectType.ObjTst(Object o1, Object o2, Boolean TextCompare) +2740 ASP.TimeAmendmentForm_aspx.Page_Load(Object Sender, EventArgs e) in D:\GrantManagementWeb\TimeAmendmentForm.aspx:27 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750 :confused: :confused: :confused: Quote
mark007 Posted August 3, 2005 Posted August 3, 2005 end select if not page.ispostback if not session("CurrentGrantExpDate") is dbnull.value then 'check it's not null select case session("CurrentGrantExpDate") < now() case true lblNewExpDate.visible=false :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.