473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Sql server date question {C#}

153 100+
I am string dates in DateTime format by two methods.

One in which i use DateTime.Now and other in which i manually create a DateTime object and fill the day,yeay,month etc.

During debugging DateTime.Now shows
'2/14/2009 11:28:44 AM'

And in manualy created DateTime object it shows
'2/14/0009 11:50:39 AM'

Both are exactly same ! (some diff due to diff times of degugging)

But when I use DateTime.Now it works fine and when I use the other it shows this error
(The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.)


WHERE AM I WRONG ????
Feb 14 '09 #1
2 1467
akshaycjoshi
153 100+
Ok i found where the problem is

INSERT INTO [CMS].[dbo].[Call_Data]( [Ext_Number],[Trunk_Number],[Cost],[Pin],[Account],[Called_Number],[Duration],[Description],[Call_Date] ) VALUES ('111','1',20,' ',' ','351',2,'Success','2/14/0009 12:01:02 PM' )


INSERT INTO [CMS].[dbo].[Call_Data]( [Ext_Number],[Trunk_Number],[Cost],[Pin],[Account],[Called_Number],[Duration],[Description],[Call_Date] ) VALUES ('111','1',20,' ',' ','351',2,'Success','2/14/2009 12:06:40 PM' )

See the bold date part.
When i fill it to datetime it gets filled as 00009.
I fill it as argument in DateTime Constructor (...,09,...)
How to solve this ?
How would i solve this ?
Feb 14 '09 #2
ck9663
2,878 Expert 2GB
Read this and this


-- CK
Feb 14 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
5
by: sandman | last post by:
I've been testing my web app on another workstation to simulate using the server time. The test pc's time is an hour behind the server time and when the user processes a request, the server time...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
4
by: brfin999 | last post by:
Server time zone 1 hour different from Client time zone. .Net 1.1 c# Win Forms app: actual date 9/25/04 displays 9/24/04 11:00 PM. When I change client time zone to equal server time zone, date...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
2
by: Bill | last post by:
Sorry re-posted as my email setting were wrong on the last post I wonder if anyone can help. I have a scheduled job running overnight to delete old records for a particular Db table. ...
0
by: MaartenVR | last post by:
sub: MS SQL server and (missing) ANSI DATE-datatype I’m working at a company who has developed a large client/server application in Delphi 6, with Interbase as the DB-server (both Borland...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.