Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Errors caused by invalild dates in the SalesLogix entity model

Working with non-nullable types in C# can be a bit of a pain.  In the world of SalesLogix you may occasionally run into an error like this:

The key to this error is the part about "Data value overflowed the type used by the provider ".  How do you know?  Well trust me it is.  We can take a look at how to demonstrate this error with these simple lines of code:

Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;
account.CreateDate = DateTime.MinValue; //1/1/0001
account.Save();

Attempting to run this code will result in a more verbose error than shown in the screen shot but still caused by the same underlying problem:

The statement has been terminated. : The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.

This error is being caused by a date value that is out of range of the DateTime data type used by the SalesLogix OLE DB provider.  The SalesLogix provider uses the SQL Server DATETIME data type which only supports years  1753-9999. 

C# on the other hand, represents a date as the C# DateTime data type.  This is equivalent to the SQL Server 2008 DATETIME2 data type which accepts a date range of "0001/01/01" through "9999/12/31".

When attempting to store a date that is outside the DATETIME data type (1753-9999) you will get the errors "data value overflowed the type used by the provider" or "conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value".

Based on just the on screen error shown above, you cannot be sure where this data conversion error occurred.  If you look on the web server in the Event Logs under Application you should see an error log entry with hopefully more details as to where this failure occurred.  If you can find where the error occurred, take a look there and you will find it contains some date that is not within the 1753-9999 year date range or is blank.

What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Manipulating the DependencyLookup Control in the Infor CRM Web Client (Formerly Saleslogix)
 The Dependency Lookup control in the Saleslogix web client is what is used for the hierarchical Are
Posted on Nov 14, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (formerly Saleslogix) Statement of Direction
Learn more about the future of Infor CRM. Recently I received my login information for the Infor Partn
Posted on Nov 13, 2014 by Brianna Ojard to The Inbox
 
   Adding a report link to the Common Tasks pane in Infor CRM (formerly Saleslogix)
When you are viewing an Entity Detail page, the Common Tasks pane on the right of the page provides a nu
Posted on Nov 12, 2014 by Jason Buss to Jason Buss' Blog
 
Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register