Results 1 to 4 of 4

Thread: Help with Crystal Reports

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    midewest u.s.
    Posts
    275

    Help with Crystal Reports

    Hello, I am using Crystal Reports .NET for VB .NET. I am using a Crystal Report to load a list of payments for the company i work at. I got it all to work fine, except when I load the report through VB .NET it asks me to type in the database password, which wont work well since not everyone who will need to sue this program know the password, if any of them. Can anyone tell me how to save the password to the report somehow to avoid the login screen? Thanks in advance

  2. #2
    Hyperactive Member
    Join Date
    May 2001
    Posts
    306
    i'm not sure how to solve that in Crystal .Net but using VB6 and Crystal 8.5 I do the following

    [Highlight=VB]
    With frmMPSSMain.CrystalReport1
    .Reset
    .Connect = "DSN=" & g_SERVER & ";UID=" & g_SYSUserID & ";PWD=" & g_SYSPW & ";DBQ=" & g_DBName
    .ReportFileName = g_ReportLoc & "PAFOld.rpt"
    .SelectionFormula = "{GetProposals_SJC.ProspectNo} = '" & param & "'"
    .Action = 1
    End With
    [\vBcode]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    midewest u.s.
    Posts
    275

    ****RESOLVED**** Help with Crystal reports

    Heres the fix if you need it...
    'Imports
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.CrystalReports.Engine




    'Variables
    Dim repDoc As New AcctCard() ' your crystal report name
    Dim subRepDoc As New ReportDocument()
    Dim crSections As Sections
    Dim crsection As Section
    Dim crReportObjects As ReportObjects
    Dim crReportObject As ReportObject
    Dim crSubReportObject As SubreportObject
    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As Table
    Dim crLogOnInfo As TableLogOnInfo
    Dim crConnInfo As New ConnectionInfo()



    'in the Public Sub New() sub under the Region Windows Forms
    'Generated Code


    crDatabase = repDoc.Database
    crTables = crDatabase.Tables

    For Each crTable In crTables
    With crConnInfo
    .ServerName = "server name"
    .DatabaseName = "db name"
    .UserID = "user name"
    .Password = "password "
    End With
    crLogOnInfo = crTable.LogOnInfo
    crLogOnInfo.ConnectionInfo = crConnInfo
    crTable.ApplyLogOnInfo(crLogOnInfo)
    Next

    crSections = repDoc.ReportDefinition.Sections

    For Each crsection In crSections
    crReportObjects = crsection.ReportObjects
    For Each crReportObject In crReportObjects
    If crReportObject.Kind = ReportObjectKind.SubreportObject Then
    crSubReportObject = CType(crReportObject, SubreportObject)
    subRepDoc = crSubReportObject.OpenSubreport(crSubReportObject.SubreportName)
    crDatabase = subRepDoc.Database
    crTables = crDatabase.Tables

    For Each crTable In crTables
    With crConnInfo
    .ServerName = "server name"
    .DatabaseName = "db name"
    .UserID = "user name"
    .Password = "password "
    End With
    crLogOnInfo = crTable.LogOnInfo
    crLogOnInfo.ConnectionInfo = crConnInfo
    crTable.ApplyLogOnInfo(crLogOnInfo)
    Next

    End If
    Next
    Next

    crView.ReportSource = repDoc
    crView.DisplayGroupTree = False

  4. #4
    Lively Member
    Join Date
    May 2003
    Posts
    78
    Cheers Tool whoever you are, whereever you are

    You post of how how you did it (above) has saved me

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