.NET技术支持者

  博客园 :: 首页 :: 博问 :: 闪存 :: :: 联系 :: 订阅 订阅 :: 管理 ::

修改文本
protected System.Web.UI.WebControls.Button btnChangeText;
  protected CrystalDecisions.Web.CrystalReportViewer cRV;
  myReport ReportDoc = new myReport();
  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   string strProvider = "Server=(local);DataBase=Northwind;UID=sa;PWD=111";
   SqlConnection MyConn = new SqlConnection(strProvider);
   MyConn.Open();
   string strSelOrders = "Select * from orders";
   string strSelOrdersDetails = "Select * from [Order Details]";
   SqlDataAdapter daOrder = new SqlDataAdapter(strSelOrders,MyConn);
   SqlDataAdapter daOrderDetails = new SqlDataAdapter(strSelOrdersDetails,MyConn);
   DataSet ds = new DataSet();
   daOrder.Fill(ds,"orders");
   daOrderDetails.Fill(ds,"Order Details");
   
   ReportDoc.SetDataSource(ds);
   cRV.ReportSource = ReportDoc;
  }
private void btnChangeText_Click(object sender, System.EventArgs e)
  {
   
   TextObject tb = (TextObject )ReportDoc.ReportDefinition.ReportObjects["Text2"];
   tb.Text = "订单号";
  }

装载
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
  protected System.Web.UI.WebControls.Button btnLoad;
  protected System.Web.UI.HtmlControls.HtmlInputFile File1;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   if(Session["filename"]!=null)
    CrystalReportViewer1.ReportSource = Session["filename"].ToString();

  }
private void btnLoad_Click(object sender, System.EventArgs e)
  {
   string strName = File1.PostedFile.FileName;
   if(strName.Trim()!="")
   {
    CrystalReportViewer1.ReportSource = strName;
    Session["filename"] = strName;
   }

  }

posted on 2005-10-25 17:14  LDAR泄漏检测与修复  阅读(1285)  评论(1编辑  收藏  举报