Crystalreports不在webserver上工作 [英] Crystalreports not working on webserver

查看:77
本文介绍了Crystalreports不在webserver上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

crystalreports正在使用本地mac,但是没有在webserver上工作,而在webserver中运行报告时会显示crysreport页面,当我选择一个id时我有一个下拉列表并单击一个按钮它应该显示该特定记录但是它显示错误:'此页面无法显示'。然后当我再次运行它时会出现错误'HTTP错误503.服务不可用。'这使得iss中的应用程序池停止。我试过了这么多,但是无法做到.Plzz帮助。这是我的代码。





SqlConnection con = new SqlConnection(strcon) ;

protected void btndr_Click(object sender,EventArgs e)

{

string strcon = ConfigurationManager.ConnectionStrings [emprpt]。ConnectionString;

SqlConnection con = new SqlConnection();

ReportDocument rdoc = new ReportDocument();





con.Op en();

SqlCommand cmd = new SqlCommand(storedprocedure1,con);

cmd.CommandType = CommandType.StoredProcedure;

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataTable ds = new DataTable();

da.Fill(ds);

rdoc.Load (Server.MapPath(〜\\Crystalreports\\EmpReport.rpt));

rdoc.SetDataSource(ds);

rdoc.SetParameterValue( ecode,ddlecode.SelectedValue.ToString());

CrystalReportViewer2.ReportSource = rdoc;

CrystalReportViewer2.DataBind();

con .Close();



}

protected void ddl()

{

using(SqlConnection conn = new SqlConnection(strcon))

{

SqlCommand cmd = new SqlCommand(从Employeesms中选择DISTINCT ecode,conn);

conn.Open();

ddlecode.DataTextField =ecode;

ddlecode.DataValueField =ecode;

ddlecode.DataSource = cmd.ExecuteReader();

ddlecode.DataBind();

ddlecode.Items.Insert(0,new ListItem(ALL,0));

conn.Close();





}

}

The crystalreports is working on local mac,but is not working on webserver,while running the report in webserver the crysreport page is displayed ,I have a dropdownlist when I select a id and click a button it should display that particular record but it is displaying error: ’This page cannot be displayed’.Then when I run it again it gives an error as ‘HTTP Error 503. The service is unavailable.’ Which makes the Application Pool in the iss to get stopped.I have tried so much,but couldn’t make it.Plzz help.This is my code.


SqlConnection con = new SqlConnection(strcon);
protected void btndr_Click(object sender, EventArgs e)
{
string strcon = ConfigurationManager.ConnectionStrings["emprpt"].ConnectionString;
SqlConnection con = new SqlConnection();
ReportDocument rdoc = new ReportDocument();


con.Open();
SqlCommand cmd = new SqlCommand("storedprocedure1 ", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable ds = new DataTable();
da.Fill(ds);
rdoc.Load(Server.MapPath("~\\Crystalreports\\EmpReport.rpt"));
rdoc.SetDataSource(ds);
rdoc.SetParameterValue("ecode", ddlecode.SelectedValue.ToString());
CrystalReportViewer2.ReportSource = rdoc;
CrystalReportViewer2.DataBind();
con.Close();

}
protected void ddl()
{
using (SqlConnection conn = new SqlConnection(strcon))
{
SqlCommand cmd = new SqlCommand("select DISTINCT ecode from Employeesms", conn);
conn.Open();
ddlecode.DataTextField = "ecode";
ddlecode.DataValueField = "ecode";
ddlecode.DataSource = cmd.ExecuteReader();
ddlecode.DataBind();
ddlecode.Items.Insert(0, new ListItem("ALL", "0"));
conn.Close();


}
}

推荐答案

这篇关于Crystalreports不在webserver上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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