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("CrystalRepor ts.ObjectF actory.2")
Response.ExpiresAbsolute = Now() - 1
'2. Create Viewer
Dim viewer
Set viewer = objectFactory.CreateObject ("CrystalR eports.Cry stalReport Interactiv eViewer")
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("Repor tName")
viewer.URI = "interactiveViewer.asp?Rep ortName=" + Server.URLEncode(theReport Name)
'using sdk
Set rptAppSession = objectFactory.CreateObject ("CrystalR eports.Rep ortAppSess ion")
rptAppSession.Initialize
Set ReportDoc = rptAppSession.CreateServic e("Crystal ClientDoc. ReportClie ntDocument ")
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 ("CrystalC lientDoc.R eportClien tDocument" )
'clientDoc.Open theReportName
Response.Write(theReportNa me)
'viewer.ReportSource = clientDoc.ReportSource
'5. User name and Password Variables
Dim userName, password
userName = "abc"
password = "abc"
ReportDoc.DatabaseControll er.Logon "abc", "abc"
viewer.ReportSource = ReportDoc.ReportSource
'viewer.EnableLogonPrompt = false
Dim BooleanSearchControl
Set BooleanSearchControl = objectFactory.CreateObject ("CrystalR eports.Boo leanSearch Control")
BooleanSearchControl.Repor tDocument = ReportDoc
viewer.BooleanSearchContro l = BooleanSearchControl
viewer.ProcessHttpRequest Request, Response, Null
' ReportClientDocument will be automatically closed when clientDoc is released
%>
<%@ 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("CrystalRepor
Response.ExpiresAbsolute = Now() - 1
'2. Create Viewer
Dim viewer
Set viewer = objectFactory.CreateObject
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("Repor
viewer.URI = "interactiveViewer.asp?Rep
'using sdk
Set rptAppSession = objectFactory.CreateObject
rptAppSession.Initialize
Set ReportDoc = rptAppSession.CreateServic
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
'clientDoc.Open theReportName
Response.Write(theReportNa
'viewer.ReportSource = clientDoc.ReportSource
'5. User name and Password Variables
Dim userName, password
userName = "abc"
password = "abc"
ReportDoc.DatabaseControll
viewer.ReportSource = ReportDoc.ReportSource
'viewer.EnableLogonPrompt = false
Dim BooleanSearchControl
Set BooleanSearchControl = objectFactory.CreateObject
BooleanSearchControl.Repor
viewer.BooleanSearchContro
viewer.ProcessHttpRequest Request, Response, Null
' ReportClientDocument will be automatically closed when clientDoc is released
%>
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?
ASKER
Oracle is the data source, and I am using odbc/RDO to connect to the the datasource in the Crystal report.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hth
matt