Click to See Complete Forum and Search --> : [RESOLVED] Crystal XI and ASP.NET
Besoup
Apr 18th, 2008, 01:05 PM
Hey all,
I thought I saw this type of topic posted before but havin a hard time finding anything on it. Basically I have a crystal report that is getting it's data through a OLE DB source (SQL server 2000) inside the report. I have included it into my asp.net and when I load the page it is asking me for my login information. I could have sworn that I saw a loop to handle the login info a while ago but not finding it.
Anyone have an answer for this?
Thanks in advance.
Besoup
Apr 18th, 2008, 02:21 PM
Found the solution...
Dim crtableLogoninfos As New TableLogOnInfos()
Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim crReportDocument As New ReportDocument()
crReportDocument.Load(Server.MapPath("rep\JDView.rpt"))
'Set the ConnectionInfo properties for logging on to
'the Database
'If you are using ODBC, this should be the
'DSN name NOT the physical server name. If
'you are NOT using ODBC, this should be the
'physical server name
With crConnectionInfo
.ServerName = "XXXX"
'If you are connecting to Oracle there is no
'DatabaseName. Use an empty string.
'For example, .DatabaseName = ""
.DatabaseName = "XXXX"
.UserID = "XXXX"
.Password = "XXXX"
End With
'This code works for both user tables and stored
'procedures. Set the CrTables to the Tables collection
'of the report
CrTables = crReportDocument.Database.Tables
'Loop through each table in the report and apply the
'LogonInfo information
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
'If your DatabaseName is changing at runtime, specify
'the table location.
'For example, when you are reporting off of a
'Northwind database on SQL server you
'should have the following line of code:
'CrTable.Location = "Northwind.dbo." & CrTable.Location.Substring(CrTable.Location.LastIndexOf(".") + 1)
Next
'Set the viewer to the report object to be previewed.
crViewJob.ReportSource = crReportDocument
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.