Link to home
Start Free TrialLog in
Avatar of sandip_prashar
sandip_prashar

asked on

Database Logon Prompt in the interactive viewer

When I am trying to access report on web through interactive viewer.asp I am getting prompt for Database logon, here is my code:


<%@ Language=VBScript CodePage=65001 ENABLESESSIONSTATE = False %>
<% Option Explicit
' Note - the CodePage=65001 is needed to display Unicode text correctly in the viewer
'        if Session is null for ProcessHttpRequest


'1. Create the ObjectFactory to instantiate Crystal Objects
Dim objectFactory, ReportDoc, rptAppSession
Set objectFactory = CreateObject("CrystalReports.ObjectFactory.2")

Response.ExpiresAbsolute = Now() - 1
      
   
'2. Create Viewer
Dim viewer
Set viewer = objectFactory.CreateObject("CrystalReports.CrystalReportInteractiveViewer")  
viewer.Name = "page"
viewer.IsOwnForm = true       
viewer.IsOwnPage = true

'3. Get the Report
Dim theReportName
theReportName = Request.Form("ReportName")
if theReportName = "" then theReportName = Request.QueryString("ReportName")
viewer.URI = "interactiveViewer.asp?ReportName=" + Server.URLEncode(theReportName)


'using sdk

Set rptAppSession = objectFactory.CreateObject("CrystalReports.ReportAppSession")
    rptAppSession.Initialize
Set ReportDoc = rptAppSession.CreateService("CrystalClientDoc.ReportClientDocument")
    ReportDoc.open (theReportName)

   ' If ReportDoc.IsReadOnly Then
       ' Response.Write "The file is read-only."
       ' Set OpenReport = Null
   'Else
       ' Set OpenReport = ReportDoc
   '     Response.Write "The file is read-only."
  '  End If



'4. Create the ReportClientDocument
'Dim clientDoc
'Set clientDoc = objectFactory.CreateObject("CrystalClientDoc.ReportClientDocument")
'clientDoc.Open theReportName

Response.Write(theReportName)
'viewer.ReportSource = clientDoc.ReportSource

'5. User name and Password Variables
Dim userName, password
userName = "abc"
password = "abc"


ReportDoc.DatabaseController.Logon "abc", "abc"



viewer.ReportSource = ReportDoc.ReportSource



'viewer.EnableLogonPrompt = false


Dim BooleanSearchControl
Set BooleanSearchControl = objectFactory.CreateObject("CrystalReports.BooleanSearchControl")
BooleanSearchControl.ReportDocument = ReportDoc
viewer.BooleanSearchControl = BooleanSearchControl
viewer.ProcessHttpRequest Request, Response, Null
' ReportClientDocument will be automatically closed when clientDoc is released
%>
Avatar of mnye
mnye
Flag of United States of America image

open your report in Crystal Reports, be sure that "Save Data With Report" is not checked under the "File" menu.

hth
matt
Avatar of sandip_prashar
sandip_prashar

ASKER

I did that but it is still giving the same logon prompt, it prompts me for the paramter first and then the database logon prompt
what is your data source?
Oracle is the data source, and I am using odbc/RDO to connect to the the datasource in the Crystal report.
ASKER CERTIFIED SOLUTION
Avatar of sandip_prashar
sandip_prashar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial