sascha salentin
2005-06-06 09:13:02 UTC
Hi,
ich habe nach Anleitung von Seagate CrystalReport-Dokumente eingebunden.
Funktioniert auch ganz gut, ich habe nur ein Problem, das Crystal-Dokument
möchte eine Datenbankanmeldung haben, wie übergebe ich diese von vb aus??
Bisheriger Code:
Dim oReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oReport.Load(ProgramPath & "\RPT\" & Rep)
Dim LogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim Table As CrystalDecisions.CrystalReports.Engine.Table
For Each Table In oReport.Database.Tables
'Get the TableLogOnInfo object
LogonInfo = Table.LogOnInfo
'Set the server name, database name user ID, and password.
LogonInfo.ConnectionInfo.ServerName = "localhost"
LogonInfo.ConnectionInfo.DatabaseName = "SQL-DB"
LogonInfo.ConnectionInfo.UserID = SQLDataBaseUser
LogonInfo.ConnectionInfo.Password = SQLDataBasePassword
'Apply the connection information to the table.
Table.ApplyLogOnInfo(LogonInfo)
Next Table
Dim paraValue As New CrystalDecisions.Shared.ParameterDiscreteValue
paraValue.Value = DatumVon
Dim currValue As CrystalDecisions.Shared.ParameterValues
currValue =
oReport.DataDefinition.ParameterFields("DatumVon").CurrentValues
currValue.Add(paraValue)
oReport.DataDefinition.ParameterFields("DatumVon").ApplyCurrentValues(currValue)
paraValue.Value = DatumBis
currValue =
oReport.DataDefinition.ParameterFields("DatumBis").CurrentValues
currValue.Add(paraValue)
oReport.DataDefinition.ParameterFields("DatumBis").ApplyCurrentValues(currValue)
myCrystalReportViewer.ReportSource = oReport
myCrystalReportViewer.Zoom(75)
Gruß sascha
ich habe nach Anleitung von Seagate CrystalReport-Dokumente eingebunden.
Funktioniert auch ganz gut, ich habe nur ein Problem, das Crystal-Dokument
möchte eine Datenbankanmeldung haben, wie übergebe ich diese von vb aus??
Bisheriger Code:
Dim oReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oReport.Load(ProgramPath & "\RPT\" & Rep)
Dim LogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim Table As CrystalDecisions.CrystalReports.Engine.Table
For Each Table In oReport.Database.Tables
'Get the TableLogOnInfo object
LogonInfo = Table.LogOnInfo
'Set the server name, database name user ID, and password.
LogonInfo.ConnectionInfo.ServerName = "localhost"
LogonInfo.ConnectionInfo.DatabaseName = "SQL-DB"
LogonInfo.ConnectionInfo.UserID = SQLDataBaseUser
LogonInfo.ConnectionInfo.Password = SQLDataBasePassword
'Apply the connection information to the table.
Table.ApplyLogOnInfo(LogonInfo)
Next Table
Dim paraValue As New CrystalDecisions.Shared.ParameterDiscreteValue
paraValue.Value = DatumVon
Dim currValue As CrystalDecisions.Shared.ParameterValues
currValue =
oReport.DataDefinition.ParameterFields("DatumVon").CurrentValues
currValue.Add(paraValue)
oReport.DataDefinition.ParameterFields("DatumVon").ApplyCurrentValues(currValue)
paraValue.Value = DatumBis
currValue =
oReport.DataDefinition.ParameterFields("DatumBis").CurrentValues
currValue.Add(paraValue)
oReport.DataDefinition.ParameterFields("DatumBis").ApplyCurrentValues(currValue)
myCrystalReportViewer.ReportSource = oReport
myCrystalReportViewer.Zoom(75)
Gruß sascha