Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2005, 12:30 AM
Authorized User
 
Join Date: Mar 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lamdog
Default Inserting Date in Sql Server

Hi,
   I tried to insert date into the Sql database using parameters but it prompt me this error message:
"Arithmetic overflow error converting expression to data type datetime. The statement has been terminated."
   My date format is in dd/MM/yyyy. Can it be the format in the Sql database that causes this error? Any ideas?
   Thanks.

Regards
 
Old March 10th, 2005, 01:17 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Make sure you data type in SQL is date time. Pass the parameter with single quotes. Ex '01/01/2005' Also, make sure the date is valid. For example I have seen the error when trying to insert an incorrect date such as '02/29/2005'
 
Old March 10th, 2005, 03:55 AM
Authorized User
 
Join Date: Mar 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lamdog
Default

I have changed the data type for the field and it worked fine now i have to format the datetime to my output of my datagrid without displaying the time...
Thanks for the help...

Regards
 
Old March 10th, 2005, 08:00 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

also check out this thread.

_____________
Mehdi.
software student.
 
Old March 15th, 2005, 10:28 AM
Authorized User
 
Join Date: Mar 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to akash Send a message via MSN to akash
Default

Checkout this format
dd-MM-yyyy

 
Old March 18th, 2005, 01:05 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Code:
<asp:BoundColumn DataField=startDate HeaderText="startDate" DataFormatString="{0:dd-MMM-yyyy HH:mm:ss}">
</asp:BoundColumn>
Custom DateTime Format Strings

_____________
Mehdi.
software student.





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL server Inserting duplicate rows. shaileshmark SQL Server 2000 6 December 14th, 2006 11:09 PM
Inserting & Retrieving Images on Sql Server adamusufi SQL Server 2000 6 June 26th, 2005 03:32 PM
Inserting Images and retrieving from SQL SERVER adamusufi VB.NET 2002/2003 Basics 0 June 24th, 2005 04:13 AM
inserting some data from xml file to sql server ak Classic ASP XML 1 February 25th, 2004 10:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.