Wednesday, March 28, 2012

String was not recognized as a valid DateTime.

hi,

i just uploaded my web application to a remote server, everything works fine on my local machine..

but i m getting this error message on my remote server .. that is perhaps on the remote pc the sql server is handling datetime in a different format... how to check it and how can i set it up same as my local sql server date time format? or is there any other solution to it ?

String was not recognized as a valid DateTime.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.FormatException: String was not recognized as a valid DateTime.

in the database... column type is date time and and even this simple query is generating this error..

dim str as sqldatetime = sqldatetime.parse("Select 'datecolumn' from table")

thanks

Ok wich version of SQL server do u have on your pc and on your server?

That error might appear when you type a string in a wrong way

acepted formats in SQL SERVER EXPRESS 2005

01/01/2006

1/1/2006

1/1/06

1/01/06

1/01/2006

01/1/2006

01/1/06

I hope this helps


no, i m not inserting any date... when sumone gets registered to the system.. the stored procedure gets the date using function getdate() and i m just selecting it using .. a datareader and puting it in

sqlDateTime type variable... it is working perfectly in local pc.. that is sql server 2000 same is on the SERVER pcc... but i found one difference that in my pc it is storing date as mm/dd/yy and on server pc it is generating date using getdate() as yy/dd/mm... although did't change any settings....

and this format of yy/dd/mm is giving error when i retrieve it in variable sqlDateTime in asp.net!

even if i change its format in selection... then i wont work on my local pc.. because sql server on my local pc is generating date using getdate() as mm/dd/yy...

any help ?

thanks

0 comments:

Post a Comment