当前位置: 代码迷 >> ASP.NET >> owc图片资料改变,页面图片不会变
  详细解决方案

owc图片资料改变,页面图片不会变

热度:7952   发布时间:2013-02-25 00:00:00.0
owc图片文件改变,页面图片不会变
protected void ss_Click(object sender, EventArgs e)
  {
  System.IO.File.Delete(MapPath("./ShowData1.gif"));
  string tj1 = BeginTime.Text.Trim();
  string tj2 = EndTime.Text.Trim();
  string tj3 = xq_name.Text.Trim();
  string tj4;
  //File.Delete(MapPath("文件路径"))
  //string deleteFileName = "./ShowData.gif";

  if (tj1 != "" && tj2 != "" && tj3 != "")
  {
   
  string strSeriesName = "图例";
  string ConnectString = "server=10.81.198.238;uid=gaohanying;pwd=123456;database=master";
  //string Sqk = "select wd_id from wdyl_chazhibiao where xq_name='+tj3+'";
  string Sqk = "SELECT wd_id FROM wdyl_chazhibiao WHERE xq_name = '" + tj3 + "'";
  //string Sql = "select wendu1 ,riqi from shishi3 where riqi>='" + tj1 + "'and riqi<='" + tj2 + "'";

  SqlConnection myConn = new SqlConnection(ConnectString);
  myConn.Open();
  SqlCommand cmd = new SqlCommand(Sqk, myConn);
  SqlDataReader dr = cmd.ExecuteReader();
  DataSet ds = new DataSet();

  if (dr.Read())
  {
   
   
  }
   
  tj4 = dr["wd_id"].ToString();
  string Sql = "select "+tj4+",riqi from shishi3 where riqi>='" + tj1 + "'and riqi<='" + tj2 + "'";
  dr.Close();//关闭
  dr.Dispose();//释放
   
  SqlDataAdapter Da = new SqlDataAdapter(Sql, myConn);

  Da.Fill(ds);

   
  GridView1.DataSource = ds.Tables[0];
  GridView1.DataBind();
  GridView1.Visible = true;

  //存放月
  string[] MonNum = new string[300];
  //存放数据
  string[] MonCount = new string[300];
  //为数组赋值
  for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  {
  MonCount[i] = ds.Tables[0].Rows[i][0].ToString();
  MonNum[i] = ds.Tables[0].Rows[i][1].ToString();
  }
  //为x轴指定特定字符串,以便显示数据(月份)
  string strXdata = string.Empty;
  foreach (string strData in MonNum)
  {
  strXdata += strData + "\t";
  }
  //为y轴指定特定字符串
  string strYdata = string.Empty;
  foreach (string strValue in MonCount)
  {
  strYdata += strValue + "\t";
  }
  //创建对象放置图表 
  ChartSpace laySpace = new ChartSpaceClass();
  //在chartspace对象中添加图表
  ChChart InsertChart = laySpace.Charts.Add(0);
  //指定绘制图表的类型。类型可以通过OWC.ChartChartTypeEnum枚举值得到
  //InsertChart.Type = ChartChartTypeEnum.chChartTypePie; //饼图
  InsertChart.Type = ChartChartTypeEnum.chChartTypeLine;//折线图
  //InsertChart.Type = ChartChartTypeEnum.chChartTypeArea;//面积图
  //InsertChart.Type = ChartChartTypeEnum.chChartTypeBarClustered;//条形图
  //InsertChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;//柱形图
  相关解决方案