Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 10th, 2005, 12:30 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
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
  #2 (permalink)  
Old March 10th, 2005, 01:17 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
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'
  #3 (permalink)  
Old March 10th, 2005, 03:55 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
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
  #4 (permalink)  
Old March 10th, 2005, 08:00 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

also check out this thread.

_____________
Mehdi.
software student.
  #5 (permalink)  
Old March 15th, 2005, 10:28 AM
Authorized User
 
Join Date: Mar 2005
Location: delhi, Delhi, India.
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

  #6 (permalink)  
Old March 18th, 2005, 01:05 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.