0

任何人都可以帮助我以编程方式仅更改水晶报告的连接字符串。我已经使用报表设计器向导中的基本拖放方法设计了一个报表,并且已经使用右侧面板工具绑定了字段,该面板工具已经从那里使用 ODBC 向导连接向导进行了连接。

我想要的是我可以编写可以更改连接字符串但字段绑定相同的代码。这种情况可以在我的系统中使用,可以很容易地移动到其他计算机并连接到具有相同数据库的数据库。它就像动态连接字符串,但拖放绑定仍然与新的连接字符串连接。同一个数据库。 .

我使用 MySQL 数据库、VB.NET 2010、Crystal Report for VB.Net 2010

谢谢你..

4

1 回答 1

0

I am not sure that I can help you.
What I am doing is that I fill a datatable and apply it to the crystal Report. My example is kind of different, since I upload the rpt file dynamically.

   Dim cryRpt As New ReportDocument
   Dim strReportPath As String = Me.selectedNode.RptLocation & "\" & Me.selectedNode.ReportFile 'The path for the rpt file
   cryRpt.Load(strReportPath)
   cryRpt.SetDataSource(crData) 'crData is the datatable that I am filling with data corresponding to the fields for the Crystal Report.
   crvReport.ReportSource = cryRpt  'crvReport is a CrystalReportViewer)
   crvReport.Zoom(2) ' use 1 for page width, or 2 for full page

I know that I am not helping you 100% but maybe you can find my answer as a little help. Sorry I don't have time to recreate your problem and try to solve it.

于 2012-11-06T09:34:26.983 回答