|
-
Nov 25th, 2002, 04:25 PM
#1
Thread Starter
Hyperactive Member
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
-
Nov 26th, 2002, 11:30 AM
#2
Hyperactive Member
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]
-
Nov 27th, 2002, 09:48 AM
#3
Thread Starter
Hyperactive Member
****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
-
Jul 2nd, 2003, 08:45 AM
#4
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|