473,320 Members | 1,961 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,320 software developers and data experts.

SQL-ASP.NET datetime format problem ???

Hi ,
I have two Sql Server 2000 on seperate machines ,
First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss")
And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss")

1- Date formats are different because of SQL Collation?
2- Do regional Settings affect Sql date format?
3- (Important) When inserting a datetime into first server there is no
problem (15.12.2000 12:12:12) , but when I insert into second server (if day
is greater then 12 ) the following error occurs
"The conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value"
So each time I format the datetime value to ("dd.MM.yyyy hh:mm:ss") when
inserting into second server,

I don't want to change date Format each time manuelly
So I think ,I need to know that in code behind Which date format SQL server
accept?
My app is ASP.NET with VB.NET

I use System.DateTime , should I use System.Data.SqlTypes.SqlDateTime ?
Any idea ?

Best regards...


Dec 16 '05 #1
1 2842
Always format dates to include the month as a NAME it makes some many
problems like this go away!

eg "dd MMM yyyy hh.mm.ss" or "MMM dd yyyy hh.mm.ss"

sql server( and most other databases) then has enough to go on when in
converts the string to a datetime.

i assume you are building the sql string in code, if you use dataadapters
and parameters then dot net will do the culture stuff for you.
"Ugur Ekinci" <ug**@argeset.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi ,
I have two Sql Server 2000 on seperate machines ,
First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss")
And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss")

1- Date formats are different because of SQL Collation?
2- Do regional Settings affect Sql date format?
3- (Important) When inserting a datetime into first server there is no
problem (15.12.2000 12:12:12) , but when I insert into second server (if
day is greater then 12 ) the following error occurs
"The conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value"
So each time I format the datetime value to ("dd.MM.yyyy hh:mm:ss") when
inserting into second server,

I don't want to change date Format each time manuelly
So I think ,I need to know that in code behind Which date format SQL
server accept?
My app is ASP.NET with VB.NET

I use System.DateTime , should I use System.Data.SqlTypes.SqlDateTime ?
Any idea ?

Best regards...


Dec 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Peter | last post by:
I run most of my SQL scripts via kornshell on AIX. I use the "here-document" to run some of the smaller ones. Example: #!/bin/ksh # Analyze the table. sqlplus...
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: AlessanBar | last post by:
Hello Friends !! I have a strange problem, and I need to know what would be the source of this. I have a laptop computer with the following configuration: Pentium III Brand : Toshiba Speed :...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
6
by: Fuzzydave | last post by:
I am back developing futher our Python/CGI based web application run by a Postgres DB and as per usual I am having some issues. It Involves a lot of Legacy code. All the actual SQL Querys are...
5
by: dbrother | last post by:
Access 2003 Win XP Pro SP3 Using SQL /ADO Recordsets in a Do Loop Hello, I'm using a random number generator based on an integer input from a user from a form that will get X number of random...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.