如何使用VB.Net中的代码更改DSN中的Crystal Report数据库? [英] How could I change database in DSN for Crystal Report using code in VB.Net?

查看:111
本文介绍了如何使用VB.Net中的代码更改DSN中的Crystal Report数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,
我在更改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?

推荐答案

您好,这是我过去的做法


Hi, This is how I have done it in the past


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数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆