NULL dates...

Posts   
 
    
Coolcoder
User
Posts: 37
Joined: 22-Sep-2005
# Posted on: 18-Oct-2005 11:27:33   

CType(_CaseEntity.Applicants.Items(_ApplicantSelectedIndex), EntityClasses.CaseApplicantEntity).BirthDate = ?

? = What do I need to set this to in order for the entity to save a NULL date....

I'm using Janus Controls date control, I've tried (without success)...

= Nothing = Date.MinValue

When I run SQL Profiler , it just doesnt run the query. If I pass in a date, it saves no problem.

Coolcoder
User
Posts: 37
Joined: 22-Sep-2005
# Posted on: 18-Oct-2005 11:33:34   

The actual error message when trapped, is:

"An exception was caught during the execution of an action query: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."

Coolcoder
User
Posts: 37
Joined: 22-Sep-2005
# Posted on: 18-Oct-2005 11:34:14   

The SQL Database field for this is set to allow nulls...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 18-Oct-2005 12:37:37   

CType(_CaseEntity.Applicants.Items(_ApplicantSelectedIndex), EntityClasses.CaseApplicantEntity).SetNewFieldValue("BirthDate", Nothing)

should make the field null/Nothing. Do this when saving, e.g.: you have to be sure the grid has formatting defined so that the default date for a nulldate (datetime.minvalue) is displayed as your nulldate, e.g. empty string.

Frans Bouma | Lead developer LLBLGen Pro
Coolcoder
User
Posts: 37
Joined: 22-Sep-2005
# Posted on: 19-Oct-2005 12:25:32   

Worked like a charm...many thanks