日期:2014-05-17  浏览次数:20409 次

ASP.NET编译报错!代码如下,求指导!
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace FrameWork.web.Indent.Indent_Contract
{
  public partial class Detail : System.Web.UI.Page
  {
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  string indentId = Request["IndentId"];
  string fsId = Request["fsId"];
  }
  CRport(indentId, fsId);

  }
  protected void CRport(string indentId, string fsId)
  {
  string strPath = "J:\\同步版\\SZcityBug\\SZcityBug\\FrameWork.web\\Indent\\CReport\\Detail.rpt";
  DataApp DTA = new DataApp();
  DataSet ds = DTA.myGetDataset(indentId, fsId);
  ReportDocument MyReport = new ReportDocument();
  MyReport.Load(strPath);
  MyReport.SetDataSource(ds.Tables[0]);
  this.CrystalReportViewer1.ReportSource = MyReport;
  }
  }
}

------解决方案--------------------
if (!IsPostBack)
{
string indentId = Request["IndentId"];
string fsId = Request["fsId"];
}
这两个变量定义放在 if()里面了,
应该把定义放外面,在if()里面赋值
------解决方案--------------------
变量indentId不是全局的