Geeks With Blogs

  • azamsharp The WWDC app says that there are new videos but there is nothing under videos!!! about 676 days ago
  • azamsharp Can I post my opinion on iOS 7 Beta or is it under NDA or something? about 676 days ago
  • azamsharp iOS 7 BETA installed successfully! about 676 days ago
  • azamsharp iOS 7 BETA installed! Now restoring! I am on NET10 which uses AT&T network. Hopefully 3G will still work! Lets c.. about 676 days ago
  • azamsharp The missing of button borders in Xcode 5 makes it hard to determine the clickable area. about 676 days ago
  • azamsharp I might wait for iOS to be released before I can put it on my device! Don't want a bricked or unstable device! about 676 days ago
  • azamsharp Android has many features that no one uses, number of versions that no one upgrades to and thousands of apps that no one pays for. about 676 days ago
  • azamsharp Maybe it is just me but the new iOS 7 UI looks like Windows Phone 8 UI! #maybeIamCrazy about 676 days ago
  • azamsharp Anyone using H20 network upgraded to iOS 7 BETA Keep me updated if you face any problems. about 676 days ago
  • azamsharp @merowing_ You already downloaded it! I cannot even load the developer's website! :( about 677 days ago

AzamSharp Some day I will know everything. I hope that day never comes.

While working on an application I faced the following error when trying to submit changes to the database using DLINQ:

exception = "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."

So, from the exception it seems like my date is initialized to a wrong state. By, the way I put the default value for my date to be GETDATE() in the database and while inserting I was not setting the date property namely "DateCreated" and "DateModified". So, in order for the submit changes to work I must set the "DateCreated" and "DateModified" properties as shown below:

FingerPrint finger = new FingerPrint() { InstanceID = template.InstanceID, FingerImage = digSignUI
             , DateCreated = DateTime.Now, DateModified = DateTime.Now};

But, I don't want to set the properties since it is default to "GETDATE()" in the database. Why should I do extra work?

So, in order for DLINQ to automatically insert your default values in the database you must change the "Auto Generated Value" to true. Open your "dbml" file in the designer and right click on the column you want to insert default data in my case it is "DateCreated" and set "Auto Generated Value = True". Here is the screen shot below:



One more thing that bugs me about DLINQ is that it does not automatically update the auto-generated code when I change the schema of the database table. So, I have to first delete the table from the designer and then add it back again. It would be good if we can just refresh the design view to get the latest schema.

Posted on Thursday, January 10, 2008 11:19 AM | Back to top

Comments on this post: "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Mohammad Azam | Powered by: | Join free