问题描述
亲爱的所有人,
我在更改Crystal Report的数据库时遇到问题.
我已经通过使用DSN作为数据源使用Crystal Report设计了一个报告.
我有两个数据库,例如aces_database和aces_database_2.
当我登录到branch1时,该报告将从aces_database中获取数据.
但是当我登录branch2时,我可以将我的DSN更改数据库更改为aces_database_2
但它仍然会从branch1获取数据.
我有在设计视图中更改它的方法.但我找不到通过代码更改它的方法.
Dear All,
I have a problem with changing database for crystal report.
I have design a report using crystal report by using DSN as a data source.
I have two databases such as aces_database and aces_database_2.
When I log into the branch1, the report will take data from aces_database.
but when I log into branch2, I can make my DSN change database to aces_database_2
but the it still take data from branch1.
I have the method to change it in design view. but I couldn''t find the way to change it by code.
How could I configure to change database for crystal report using vb.net?
推荐答案
Dim rptDriver as new ReportDocument
'... Load the report ect.
rptDriver.DataSourceConnections.Item(0).SetConnection(gDataBaseName, g_dbConn.Database, gUserID, gPWD)
rptDriver.Refresh
这篇关于如何使用VB.Net中的代码更改DSN中的Crystal Report数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!