本文介绍了错误:=无法打开连接。无法打开连接。安装报告{A26A9D62-94F6-44A8-A267-89B7518FFB13} .rpt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void btn1_Click(对象发件人,EventArgs e)
{
ReportDocument cr = new ReportDocument();
cr.Load(Server.MapPath( 〜/ Installation Report.rpt)) ;
TableLogOnInfo logOnInfo = new TableLogOnInfo();
// 我假设你有水晶服务器数据库
// web.config中的连接字符串
logOnInfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings [ strServer]。ToString();
logOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings [ strDBase]。ToString() ;
logOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings [ strUID]。ToString() ;
logOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings [ strPWD]。ToString() ;
TableLogOnInfo login = default (TableLogOnInfo);
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in cr.Database.Tables)
{
login = tbl.LogOnInfo;
login.ConnectionInfo.ServerName = ConfigurationManager.AppSettings [ strServer]。ToString() ;
login.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings [ strDBase]。ToString() ;
login.ConnectionInfo.UserID = ConfigurationManager.AppSettings [ strUID]。ToString() ;
login.ConnectionInfo.Password = ConfigurationManager.AppSettings [ strPWD]。ToString() ;
tbl.ApplyLogOnInfo(登录);
Cr1.DataBind();
cr.SetParameterValue( ASSETID,asstid.Text);
Cr1.ReportSource = cr;
}
解决方案
这篇关于错误:=无法打开连接。无法打开连接。安装报告{A26A9D62-94F6-44A8-A267-89B7518FFB13} .rpt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!