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
   Saleslogix XBar Installation
When installing the new XBar application I found the instructions a little vague so I thought I would pas
Posted on Jul 18, 2014 by Mark Duthoy to SalesLogix Support
 
   Finding the Current Parent Record ID in SalesLogix Web
Sometimes it's the easiest things that can be a big barrier to entry for getting started with somet
Posted on Jun 27, 2014 by Ryan Farley to Ryan Farley's Blog
 
   SalesLogix 8.1 Job Service Scheduling Executions Error Resolution
Often times a web implementation will have an application server that is used to deploy the web portals t
Posted on Jun 20, 2014 by Mark Duthoy to SalesLogix Support
 
   Saleslogix 8.1 Web Access Tab Throws Null Reference Error
 I recently had a client experiencing a problem access the Contact's Web Access tab.  Whene
Posted on Jun 18, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Debugging Custom Assemblies Using Visual Studio
Developing for Saleslogix web using external assemblies provides you with a lot of freedom when developin
Posted on Jun 10, 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