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
   CRITICAL Issue with Saleslogix v8.1 Web SNC 02- Breaks Compatability with SQL 2008R2
One of the listed fixes in SNC 02 for Saleslogix 8.1 is listed as:14095222 Enhance the SQL generation to
Posted on Apr 17, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Editing Filters in Saleslogix Web Client 8.0
Is it possible to add or remove Saleslogix filters from the List view in Accounts?
Posted on Apr 08, 2014 by SalesLogix Support to SalesLogix Questions & Answers
 
   Bug in the Saleslogix Web LiveGrid Lookup dialog
I recently ran into an issue with the Opportunity Products grid in the Saleslogix web client.  I cli
Posted on Apr 04, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Creating a Unique Saleslogix table ID in a SQL Function
A couple of months ago Ryan Farley wrote an article about how to use a SQL stored procedure to create a S
Posted on Mar 25, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Saleslogix Web Client Controls are Missing
Every so often we hear that a user can no longer add products to an opportunity whether it is a new oppor
Posted on Mar 24, 2014 by Mark Duthoy to SalesLogix Support
 
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