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
   How to Disable the ComboBox Control in the Infor CRM (Saleslogix) Web Client
There's a problem with the ComboBox control in the Infor CRM (Saleslogix) Web Client. It won't di
Posted on Jan 22, 2015 by Ryan Farley to Ryan Farley's Blog
 
   Problems running Crystal Reports in the Infor CRM (formerly Saleslogix) LAN client
We recently had a client that was using the Crystal RDC object in VBScript within the LAN client to run a
Posted on Jan 20, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Unable to Insert Opportunities in Infor CRM (formerly Saleslogix) Web Client
 I recently ran into an issue where a client was unable to insert Opportunities when logged in as pa
Posted on Jan 14, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (formerly Saleslogix) Web Client - How Time Zones Work
The Infor CRM web client utilizes  a couple of methods to determine and then present what timezones
Posted on Jan 09, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Index of Posts for Starting with Infor CRM (Saleslogix) Development
The blogs on customerfx.com go all the way back to 2003. There's years and years worth of information
Posted on Dec 30, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2015 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