Results 1 to 2 of 2

Thread: Crystal Report db login

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    North east UK
    Posts
    129

    Crystal Report db login

    Hi All,

    I have created a crystal report (with the designer) within my app using an odbc connection to an sql server. When I load the report I am always prompted for the username and password to connect to the db.

    Is there a way to code this informatio so it connects automatically to the db.

    any help appreciated.

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036
    Hi

    You need to apply for each table of the report the login information

    This is how it is done

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared

    Dim crReportDocument As New YourReportName
    crConnectionInfo = New ConnectionInfo
    With crConnectionInfo
    .ServerName = "Your Server"
    .DatabaseName = "Your DB"
    .UserID = "Your Username"
    .Password = "His password"
    End With
    crDatabase = crReportDocument.Database
    crTables = crDatabase.Tables
    For Each crTable In crTables
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next


    regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

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