急,水晶报表在客户端不显示!
int apply_id = 1;//int.Parse((string)Session[ "get_apply_id "]);
ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath( "equip_name.rpt "));
TableLogOnInfo logOnInfo = new TableLogOnInfo();
//对报表中的每个表进行循环
for (int i = 0; i == Report.Database.Tables.Count - 1; i++)
{
logOnInfo.ConnectionInfo.UserID = "wfuser ";
logOnInfo.ConnectionInfo.Password = "123456 ";
Report.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
}
string selectFormula;
selectFormula = "{t_wf_gush_charater.prj_apply_id} = " + apply_id;
CrystalReportViewer1.SelectionFormula = selectFormula;
CrystalReportViewer1.ReportSource = Report;
CrystalReportViewer1.DataBind();
//当然如果密码为空的话也同样可以使用这种方法的
//加入水晶报表代码
我的水晶报表在.net环境下能正常运行,但是我将它放在服务器上的时候,别人用浏览器察看,则水晶报表带数据的部分无法显示,但是报表的头能显示,我急死了,这是怎么回事啊,请高手帮忙解决。
------解决方案--------------------一定是楼主的连接数据库错误。
没有了数据集所以没有数据显示出来。
for (int i = 0; i == Report.Database.Tables.Count - 1; i++)
{
logOnInfo.ConnectionInfo.UserID = "wfuser ";
logOnInfo.ConnectionInfo.Password = "123456 ";
Report.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
}
为什么 这样子呢。直接强制连接不就行了。
a = System.Configuration.ConfigurationManager.AppSettings[0];
b = System.Configuration.ConfigurationManager.AppSettings[1];
c = System.Configuration.ConfigurationManager.AppSettings[2];
d = System.Configuration.ConfigurationManager.AppSettings[3];
logininfo.ConnectionInfo.ServerName = a;
logininfo.ConnectionInfo.DatabaseName = b;
logininfo.ConnectionInfo.UserID = c;
logininfo.ConnectionInfo.Password = d;
------解决方案--------------------rptDoc.Load(Server.MapPath( "..\\App_Report\\DayBuession.rpt "));
lsServer = ConfigurationManager.AppSettings[DataM.SQL_Server];
lsDatabase = ConfigurationManager.AppSettings[DataM.SQL_Database];
lsUserName = ConfigurationManager.AppSettings[DataM.SQL_UserName];
lsPassword = Confi