Exception

Exception

Post by John » Thu, 28 Aug 2003 06:56:43


When I try this from application:

adodsCh.Close();
adodsCh.CommandText="spA_GetKForCheck '" +
IntToStr((int)year) + "." + IntToStr((int)month) + "." +
IntToStr((int)day) +
"'"
;
adodsCh.Open();

I get exception:

"The conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value"

but for example if I put same call on execute it on query analyzer on SQL
server(spA_GetKForCheck '2003.1.26')

I get good result without any error.

Why I get exception from Borland.

This is store procedure which I call:

CREATE PROCEDURE spA_GetKForCheck
(
@sdater varchar(20)

)
AS
SELECT MAX(KID) AS KID FROM BKv WHERE (ValidFromDate < @sdater) AND
(ValidToDate > @sdater)
GO
 
 
 

Exception

Post by Robert Mac » Thu, 28 Aug 2003 15:29:55

Johny ( XXXX@XXXXX.COM ) moved some electrons around and created
the following:

that exception is coming from the sql server, not from delphi. most likely the
reason query analyser does not give the error is because it does the
conversation automatically.
it means that sql server does not like the format you are using.
have a look at SET DATEFORMAT in the sql online docs and put that into your
stored proc.
there was also a post in this group a few days back titles "set dateformat
problem" which dealt with the same sort of issue.


___________________________________________
Robert MacLean
robert at sadev dot co dot za
Web: http://www.yqcomputer.com/

 
 
 

Exception

Post by John » Fri, 29 Aug 2003 01:40:41

Thank you.