Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Conversion of a char data type to a datetime char
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rob Poretti
Junior Member

Canada
435 Posts

Posted - 19 March 2001 :  10:12:32  Show Profile  Visit Rob Poretti's Homepage
Hi,

In the Calender Mod, there is a function called "emitupcomingevents". It basically is used to poulate the upcomingevents section of the calender by fetching all records from "tdays date" to 180 days in the future...

Of course it works fine when used in the events.asp page, but if I try to use it from another page I get the following error:
"An exception of type 'Microsoft OLE DB provider for SQL Server: The conversion of a char data type to a datetime char type resulted in an out-of-range datetime value' was not handled."


The strange thing is that I've stepped through (I use MS VI) the events.asp page and even blocked chunks of code, to try and isolate that function and it ALWAYS works. When I paste that function into another page and call it from that page it fails. Further, if I take the strSQL string result and paste it in SQL Query analyzer SQL EM has no problem with it...

I'm at my wits end... been working on this for the last day and a half... any direction or possible ideas to explore would be appreciated...


Here is the function:

<%
function emitupcomingevents
dim rs
Set Rs = Server.CreateObject("ADODB.RecordSet")
strSql = "SELECT start_date, end_date, event_title, M_Name FROM FORUM_EVENTS Inner JOIN Forum_Members ON FORUM_EVENTS.added_by = Forum_Members.Member_ID WHERE start_date >= '" & date() & "' and start_date < '" & DateAdd("d",180,date()) & "' Order by start_date"
rs.Open strSql, my_Conn
do until rs.EOF
IF FormatDateTime(rs("Start_Date"), 2)=FormatDateTime(rs("End_Date"), 2) THEN
Response.Write "<font face=" & strDefaultFontFace & " size=" & strFooterFontSize & "><a href=events.asp?date=" & rs("Start_Date") & "><acronym title='" & formatdatetime(rs("Start_Date"),1) & "'>" & Trim(rs("Event_Title")) & "</acronym></a></font><br>"
ELSE
Response.Write "<font face=" & strDefaultFontFace & " size=" & strFooterFontSize & "><a href=events.asp?date=" & rs("Start_Date") & "><acronym title='" & formatdatetime(rs("Start_Date"),1) & " - " & formatdatetime(rs("End_Date"),1) & "'>" & Trim(rs("Event_Title")) & "</acronym></a></font><br>"
END IF
rs.MoveNext
loop
rs.Close
set rs = nothing
end function
%>


Thanks!

Rob

  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07