Results 1 to 2 of 2

Thread: [RESOLVED] Crystal XI and ASP.NET

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Resolved [RESOLVED] Crystal XI and ASP.NET

    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.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Crystal XI and ASP.NET

    Found the solution...

    vb Code:
    1. Dim crtableLogoninfos As New TableLogOnInfos()
    2.     Dim crtableLogoninfo As New TableLogOnInfo()
    3.     Dim crConnectionInfo As New ConnectionInfo()
    4.     Dim CrTables As Tables
    5.     Dim CrTable As Table
    6.     Dim TableCounter
    7.  
    8.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    9.         Dim crReportDocument As New ReportDocument()
    10.  
    11.  
    12.         crReportDocument.Load(Server.MapPath("rep\JDView.rpt"))
    13.  
    14.  
    15.         'Set the ConnectionInfo properties for logging on to
    16.         'the Database
    17.         'If you are using ODBC, this should be the
    18.         'DSN name NOT the physical server name. If
    19.         'you are NOT using ODBC, this should be the
    20.         'physical server name
    21.  
    22.  
    23.         With crConnectionInfo
    24.             .ServerName = "XXXX"
    25.             'If you are connecting to Oracle there is no
    26.             'DatabaseName. Use an empty string.
    27.             'For example, .DatabaseName = ""
    28.             .DatabaseName = "XXXX"
    29.             .UserID = "XXXX"
    30.             .Password = "XXXX"
    31.         End With
    32.  
    33.  
    34.         'This code works for both user tables and stored
    35.         'procedures. Set the CrTables to the Tables collection
    36.         'of the report
    37.  
    38.         CrTables = crReportDocument.Database.Tables
    39.         'Loop through each table in the report and apply the
    40.         'LogonInfo information
    41.  
    42.  
    43.         For Each CrTable In CrTables
    44.             crtableLogoninfo = CrTable.LogOnInfo
    45.             crtableLogoninfo.ConnectionInfo = crConnectionInfo
    46.             CrTable.ApplyLogOnInfo(crtableLogoninfo)
    47.             'If your DatabaseName is changing at runtime, specify
    48.             'the table location.
    49.             'For example, when you are reporting off of a
    50.             'Northwind database on SQL server you
    51.             'should have the following line of code:
    52.             'CrTable.Location = "Northwind.dbo." & CrTable.Location.Substring(CrTable.Location.LastIndexOf(".") + 1)
    53.  
    54.         Next
    55.         'Set the viewer to the report object to be previewed.
    56.         crViewJob.ReportSource = crReportDocument
    57.  
    58.  
    59.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width