For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > May 2005 > ASP & Crytsal









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ASP & Crytsal
FC

2005-05-18, 4:03 pm

Dear All

I used Crystal Report 9.2 in my ASP project. I don't how to write a program
to connect to report. I used ODBC to get the data.
I try to run the asp. I got the error message.

My Program is :

<%
sampleno = cstr(trim(ucase(request("tag"))))

On Error Resume Next
'Response.Write "[" & Request("UserId") & "]-[" & Request("Pass") & "]"
'Response.end

if not isObject(Session("oApp")) then
Set Session("oApp") = Server.CreateObject("CrystalRuntime.Application")
end if
If Err.Number <> 0 Then
Response.Write "Error : " & Err.Description
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If

dim reportName
reportName =Server.MapPath ("samplerpt.rpt")

if isObject(Session("oRpt")) then
Set Session("oRpt") = Nothing
End if
Set session("oRpt") = session("oApp").OpenReport(reportname, 1)

If Err.Number <> 0 Then
Response.Write "OpenReport Error : " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If



If IsObject(session("oPageEngine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine

'------------------------------------------------------------------------------

Session("oRpt").DiscardSavedData

Session("oRpt").RecordSelectionFormula="{web_samplehdr.sampleno} ='" &
sampleno & "'"
Session("oRpt").Database.tables(1).connectionProperties("Data
Source")="localhost"
Session("oRpt").Database.tables(1).connectionProperties("Database")="pubs"
Session("oRpt").Database.tables(1).connectionProperties("User ID")="sa"
Session("oRpt").Database.tables(1).connectionProperties("Password")="sa"

%>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com