在运行时更改Crystal报表的连接属性 [英] Change Connection Properties of Crystal Report During Runtime

查看:155
本文介绍了在运行时更改Crystal报表的连接属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在运行时更改crystal report xi的连接属性,即使用vb.net 2005,ex。我有一个水晶报告,这是一个表的所有连接信息来自访问,我想在运行时将连接信息更改为SQL,使用应用登录信息



感谢

How to change the connection properties of crystal report xi during runtime, im using vb.net 2005, ex. i have a crystal report which is all connection info of a table is coming from access and i want to change the connection info to SQL during runtime, using the apply logon info

Thanks

推荐答案

Report.Database.Tables(1).ConnectionProperties("Data Source") = "Server"
Report.Database.Tables(1).ConnectionProperties("Initial Catalog") = "Database" 
Report.Database.Tables(1).ConnectionProperties("User ID") = "userID"
Report.Database.Tables(1).ConnectionProperties("Password") = "password"



如果您使用集成安全性,则无需设置用户ID和密码。



希望这会对您有所帮助


If you are using integrated security then you don't need to set the user ID and password.

Hope this will help you


仅针对数据库登录信息,请尝试:

Just for database logon info, try:
myCrystalReprot.SetDatabaseLogon("myUsername", "myPassword");





如需更改完整的连接信息,请尝试:



For full connection info change, try:

ConnectionInfo crConnectionInfo = new ConnectionInfo();

cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");
crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
   crtableLogoninfo = CrTable.LogOnInfo;
   crtableLogoninfo.ConnectionInfo = crConnectionInfo;
   CrTable.ApplyLogOnInfo(crtableLogoninfo);
}





参考:C# Crystal Reports动态登录参数 [ ^ ]


任何人都可以在下面的信息中解释我



crConnectionInfo.ServerName =您的服务器名称;

crConnectionInfo.UserID =您的数据库用户名;






以及此循环的作用



Can any one explain me below informations please

crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";



and what this loop does

foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
   crtableLogoninfo = CrTable.LogOnInfo;
   crtableLogoninfo.ConnectionInfo = crConnectionInfo;
   CrTable.ApplyLogOnInfo(crtableLogoninfo);
}




这篇关于在运行时更改Crystal报表的连接属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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