Re: Type mismatch with FormatDateTime -
11-11-2005
, 03:43 AM
"Kayda" wrote in message
news:1131666805.494346.302510 (AT) g43g2000cwa (DOT) googlegroups.com...
: Hi:
: I am passing a datetime from SQL Server and getting a "Type Mismatch"
: error when I do in my ActiveX script task in my DTS package. Why a type
: mismatch? Isn't a datetime value what is expected here?
:
: Thanks,
: Kayda
:
: strSQL = "SELECT MAX([Timestamp]) AS MaxDate FROM " & TableName & "
: WHERE Site = '" & SiteName & "'"
: Set objRS1 = objconn.execute (strSQL)
:
: If objRS1.EOF Then
: varMaxDate = #1/1/1970#
:
: Else
: tempdate = objRS1.Fields("MaxDate")
: varMaxDate = FormatDateTime(tempdate,2)
: End If
Where do you get the error? When the SQL statement is executed or when you
try to format the string to datetime?
If you get it during the format, then try changing this line from:
tempdate = objRS1.Fields("MaxDate")
to:
tempdate = CDate(objRS1.Fields("MaxDate"))
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp |