ADO Parameter of The Wrong Type

G

Gargamel

Hiya.

I've taken over the development of a web app written in ASP. It's not
very well coded. In the live environment it's fine, but on my local
machine it falls over whenever it tries to pass a date to a SQL Server
sproc. No idea why the person before me's been doing all this string
formatting with his dates, but anyway, the error is:

Application uses a value of the wrong type for the current operation.

The dates throughout are in mmddyyyy format, and presumably ADO
running on my local machine wants ddmmyyyy. I'm rebuilding the whole
app in C#.Net anyway so I don't think it's worth me running through
and making this jumble of code international date friendly, so my
question is, where exactly is the date format for ADO defined?
Windows? SQL Server?

Thanks loads!

Gargamel.
 
B

Bob Barrows

Gargamel said:
Hiya.

I've taken over the development of a web app written in ASP. It's not
very well coded. In the live environment it's fine, but on my local
machine it falls over whenever it tries to pass a date to a SQL Server
sproc. No idea why the person before me's been doing all this string
formatting with his dates, but anyway, the error is:

Application uses a value of the wrong type for the current operation.

The dates throughout are in mmddyyyy format, and presumably ADO
running on my local machine wants ddmmyyyy. I'm rebuilding the whole
app in C#.Net anyway so I don't think it's worth me running through
and making this jumble of code international date friendly, so my
question is, where exactly is the date format for ADO defined?
Windows? SQL Server?

Thanks loads!

Gargamel.

http://www.aspfaq.com/show.asp?id=2040


HTH,
Bob Barrows
 
K

Ken Schaefer

Hi,

It depends... :)

Each user has their own settings, and ASP, IIS, and SQL Server can all be
running under different user accounts (for an extreme example).

If you are passing string literal dates via ADO to SQL Server, then the best
format is yyyy/mm/dd (or some other version of ISO date formats that can be
miscontrued). String literals need to be parsed by SQL Server, and converted
to a valid date/time format.

Cheers
Ken



: Hiya.
:
: I've taken over the development of a web app written in ASP. It's not
: very well coded. In the live environment it's fine, but on my local
: machine it falls over whenever it tries to pass a date to a SQL Server
: sproc. No idea why the person before me's been doing all this string
: formatting with his dates, but anyway, the error is:
:
: Application uses a value of the wrong type for the current operation.
:
: The dates throughout are in mmddyyyy format, and presumably ADO
: running on my local machine wants ddmmyyyy. I'm rebuilding the whole
: app in C#.Net anyway so I don't think it's worth me running through
: and making this jumble of code international date friendly, so my
: question is, where exactly is the date format for ADO defined?
: Windows? SQL Server?
:
: Thanks loads!
:
: Gargamel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top