Passing parameters from .ASP (VBSript) to Activex object in date format

pts.
Tags:
ActiveX
ASP
Crystal Reports
HTML
Software
SQL
VBScript
Web site design & management
I have inherited the following: <%@ LANGUAGE="VBSCRIPT" %> <% dim adoconn set adoconn = server.createobject("adodb.connection") adoconn.open Application("DSN"),Application("UID"),Application("PWD") reportname = "traininghrsbyemployee.rpt" If Not IsObject (session("oApp")) Then Set session("oApp") = Server.CreateObject("CrystalRuntime.Application") End If Path = Request.ServerVariables("PATH_TRANSLATED") While (Right(Path, 1) <> "" And Len(Path) <> 0) iLen = Len(Path) - 1 Path = Left(Path, iLen) Wend If IsObject(session("oRpt")) then Set session("oRpt") = nothing End if Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1) session("oRpt").MorePrintEngineErrorMessages = False session("oRpt").EnableParameterPrompting = False session("oRpt").DiscardSavedData set session("ParamCollection") = Session("oRpt").Parameterfields set Param1 = session("ParamCollection").Item(1) NewParamValue = Request.Form("datefrom") '"08/05/2005" ' Call Param1.SetCurrentValue(CStr(NewParamValue),12) set Param2 = session("ParamCollection").Item(2) NewParamValue = Request.Form("dateto") '"09/02/2005" ' Call Param2.SetCurrentValue(CStr(NewParamValue),12) On Error Resume Next session("oRpt").ReadRecords If Err.Number <> 0 Then Response.Write "An Error has occured on the server in attempting to access the data source" Else If IsObject(session("oPageEngine")) Then set session("oPageEngine") = nothing End If set session("oPageEngine") = session("oRpt").PageEngine End If %> <!-- #include file="SmartViewerActiveX.asp" --> <% adoconn.close() %> This passes dates as strings to the object. The database structure has now changed and requires that dates be passed as datetime. Can you help?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Reformat the string to universal date format, i.e. ‘20060203’. I’m assuming MS SQL, not sequal!

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • CharlesJC
    avdberg, Try changing the double quotes (") around the date to a pound (#).
    0 pointsBadges:
    report
  • EMTCodeGOD
    Try CDate
    0 pointsBadges:
    report
  • PaulRyan
    Re-format the date string using the universal date format, e.g. 3 Feb 2006 (UK 03/02/2006) becomes '20060203'
    0 pointsBadges:
    report
  • Freejack
    Try this for your date sections: If IsDate(Request.Form("datefrom")) Then set Param1 = session("ParamCollection").Item(1) NewParamValue = CDate(Request.Form("datefrom")) '"08/05/2005" ' Call Param1.SetCurrentValue(CStr(NewParamValue),12) End If If IsDate(Request.Form("dateto")) Then set Param2 = session("ParamCollection").Item(2) NewParamValue = CDate(Request.Form("dateto")) '"09/02/2005" ' Call Param2.SetCurrentValue(CStr(NewParamValue),12) End If Also, be aware that it's generally a good idea not to store external objects in Session variables if it can be avoided because this can have a negative impact on performance in IIS.
    0 pointsBadges:
    report
  • Avdberg
    [...] Here’s a forum entry Filed under: Crystal Report [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following