水晶报表动态数据库连接Visual Studio 2010 [英] Crystal report dynamic database connection Visual Studio 2010

查看:78
本文介绍了水晶报表动态数据库连接Visual Studio 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我只希望代码在连接到在Visual Studio 2010中运行良好的Crystal报表(c#.net或vb.net)时可以动态更改数据库连接(更改服务器名称和数据库名称),而无需使用数据集或数据表?
换句话说,我只想将Visual Studio 2010中的服务器名称和数据库名称传递给Crystal报表,以在与原始创建的报表不同的其他服务器和数据库中生成报表,而不使用.net

Hi,
I just want the code to change the database connection dynamically(changing server name and database name) without using the dataset or data table when connecting to a crystal report that works well in visual studio 2010 (either c#.net or vb.net)?
In other words I want to simply pass server name and database name from visual studio 2010 to crystal reports to generate report in a different server and database other than the report originally created, without using data set or data table in .net

推荐答案

您可以使用公开的SetDatabaseLogon()方法在运行时设置连接参数.

试试:
You can use SetDatabaseLogon() method exposed to set parameters of connection at runtime.

Try:
myCrystalReprot.SetDatabaseLogon("myUsername", "myPassword","servername","dbname");



参考:
C#Crystal Reports动态登录参数 [ MSDN:使用ReportDocument类的SetDatabaseLogon()方法 [ ^ ]



Refer:
C# Crystal Reports Dynamic Logon parameters [^]
MSDN: Using the SetDatabaseLogon() Method of the ReportDocument Class[^]


参阅本文

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?waid=32615&aid=439697
See this Article

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?waid=32615&aid=439697


这篇关于水晶报表动态数据库连接Visual Studio 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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