using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Office.Interop.Owc11;
using System.Data.SqlClient;
public partial class ClusterChart : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 2000; i < 2050; i++)
{
this.DropDownList1.Items.Add(i.ToString());
}
}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
}
protected void AnYear_Click(object sender, EventArgs e)
{
this.ClustChart();
}
//生成柱状图.
public void ClustChart()
{
int strDrop = int.Parse(DropDownList1.SelectedValue.ToString());
string strCon = "Server=.;Database=Test;Uid=sa;Pwd=ok";
SqlConnection Con = new SqlConnection(strCon);
string sqlStr = "select Month, sum(SFDJ_Price) as Price from Test a where Year = " + strDrop + " GROUP BY Month ";
SqlDataAdapter sqlDA = new SqlDataAdapter(sqlStr, Con);
DataSet ds = new DataSet();
sqlDA.Fill(ds);
Label1.Text = Con.State.ToString();
this.DataGrid1.DataSource = ds;
this.DataGrid1.DataBind();
Con.Close();
this.Image2.Visible = false;
this.Image1.Visible = true;
int[] Month = new int[12] { 1, 2, 3, 4, 5, 6, 7, 8, 9 |