我需要将数千个crystal report 2008 files
中的数据提取到SQL数据库中。
我需要的数据是
参数
等等。
有没有人知道我怎么能做到这一点,也许是一个代码示例。我被告知这可以用VB完成,但不知道怎么做。非常感谢任何帮助
答案 0 :(得分:0)
这将向您展示如何设置连接信息。您可以使用相同的代码来获取连接信息:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
With crConnectionInfo
.ServerName = "YOUR SERVER NAME"
.DatabaseName = "YOUR DATABASE NAME"
.UserID = "YOUR DATABASE USERNAME"
.Password = "YOUR DATABASE PASSWORD"
End With
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
End Class
来自:http://vb.net-informations.com/crystal-report/vb.net_crystal_report_load_dynamically.htm
你应该能够通过探索ReportDocument.ReportObjects
来解决其他问题