on 05-21-2009 6:18 PM
hi, I want to change the conecction to my report on ejecution time, I'm working with visual basic 2005 and crystal reports 2008, but I just can't do that because the report(using the crystalreport viewer to see the report) doesn't change the database nor the server, I have been trying with the next code
firts:
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
next:
Dim crTableLogonInfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
next: crvhistorial is the name of the crystalreportviewer
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
Dim crTableLogonInfos As TableLogOnInfos = Me.crvhistorial.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In crTableLogonInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
End Sub
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.IntegratedSecurity = True
myConnectionInfo.DatabaseName = dll.conexionsql.Database
myConnectionInfo.ServerName = dll.conexionsql.DataSource
SetDBLogonForReport(myConnectionInfo)
End Sub
and:
at the from's load I call the procedure: ConfigureCrystalReports()
Hi,
Try this code,
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Web
Imports CrystalDecisions.Shared
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim crTables As Tables
Dim crDatabase As Database
Dim crConnectioninfo As ConnectionInfo
Dim crTablellogonInfo As TableLogOnInfo
Dim rd As New ReportDocument()
rd.Load("Give here the path of your report")
crConnectioninfo = New ConnectionInfo()
crConnectioninfo.ServerName = ""
crConnectioninfo.DatabaseName = ""
crConnectioninfo.UserID = ""
crConnectioninfo.Password = ""
crDatabase = rd.Database
crTables = crDatabase.Tables
For Each crTable As CrystalDecisions.CrystalReports.Engine.Table In crTables
crTablellogonInfo = crTable.LogOnInfo
crTablellogonInfo.ConnectionInfo = crConnectioninfo
crTable.ApplyLogOnInfo(crTablellogonInfo)
crTable.Location = crTable.Location
Next
CrystalReportViewer1.ReportSource = rd
End Sub
[See Also|http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm]
Hope this helps!
Sincerely,
Nikhil Dharme
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok, thanks you, myquestion has been answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.