using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using InfoSoftGlobal; using System.Text; using System.Data.SqlClient; using System.Data; namespace MYASP { ////// Author:jilongliang /// public partial class index : System.Web.UI.Page { protected void Page_Load (object sender, EventArgs e) { } ////// 直接在控件加载出来 /// /// /// protected void Literal1_Load (object sender, EventArgs e) { Literal1.Text = FusionCharts.RenderChart("swf/ScrollCombiDY2D.swf", "fusioncharts.xml", "", "fusioncharts1", "500", "500", false, true); } ////// 用户输入显示的图形fusioncharts /// /// /// protected void btnSubmit_Click (object sender, EventArgs e) { //Request.Form() //Label1.Text = Request["ponit1"]; StringBuilder xmlData = new StringBuilder(); xmlData.Append(""); xmlData.AppendFormat(" "); Literal1.Text = FusionCharts.RenderChart("swf/Pie3D.swf", "", xmlData.ToString(), "fusioncharts2", "800", "500", false, false); } ///", txtPoint1.Text); //txtPoint1.Text xmlData.AppendFormat(" ", txtPoint2.Text); xmlData.AppendFormat(" ", txtPoint3.Text); xmlData.AppendFormat(" ", txtPoint4.Text); xmlData.Append(" /// 从数据库读数据 /// /// /// protected void Literal2_Load (object sender, EventArgs e) { string query = "select Team ,Points from tb_charts"; StringBuilder xmlData = new StringBuilder(); using(SqlDataReader dr = SQLDBHelper.ExecuteReader(CommandType.Text, query, null)) { //xmlData.AppendFormat(" "); while(dr.Read()) { xmlData.AppendFormat(" "); Literal2.Text = FusionCharts.RenderChart("swf/Column3D.swf", "", xmlData.ToString(), "testChart", "500", "500", false, true); } } ///", dr ["Team"].ToString(), dr ["Points"].ToString()); } xmlData.AppendFormat(" /// /// /// /// protected void test2_Click (object sender, EventArgs e) { string str1=Request ["ponit1"]; Label1.Text=str1; StringBuilder xmlData = new StringBuilder(); xmlData.Append(""); xmlData.AppendFormat(" "); Literal1.Text = FusionCharts.RenderChart("swf/Pie3D.swf", "", xmlData.ToString(), "fusioncharts2", "800", "500", false, false); } protected void test2_Click1 (object sender, EventArgs e) { } } }", txtPoint1.Text); //txtPoint1.Text xmlData.AppendFormat(" ", txtPoint2.Text); xmlData.AppendFormat(" ", txtPoint3.Text); xmlData.AppendFormat(" ", txtPoint4.Text); xmlData.Append("
fusionchart.xml配置
using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Data; using System.Data.SqlClient; namespace MYASP { public class SQLDBHelper { static string str = ConfigurationManager.ConnectionStrings["SqlCon"].ToString(); ////// 增 删 改方法 /// /// /// /// ///public static int ExecuteNonQuery(CommandType cmdType, string sql, SqlParameter[] parms) { int result = -1; using (SqlConnection con = new SqlConnection(str)) { SqlCommand cmd = new SqlCommand(); PrepareSQLCommand(cmdType, sql, parms, con, cmd); result = cmd.ExecuteNonQuery(); } return result; } /// /// 提取共同方法 /// /// /// /// /// /// private static void PrepareSQLCommand(CommandType cmdType, string sql, SqlParameter[] parms, SqlConnection con, SqlCommand cmd) { cmd.Connection = con; if (con.State != ConnectionState.Open) con.Open(); cmd.CommandText = sql; cmd.CommandType = cmdType; if (parms != null) foreach (SqlParameter parm in parms) { cmd.Parameters.Add(parm); } } ////// 查询 /// /// /// /// ///public static SqlDataReader ExecuteReader(CommandType cmdType, string sql, SqlParameter[] parms) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); PrepareSQLCommand(cmdType, sql, parms, con, cmd); SqlDataReader reader = cmd.ExecuteReader(); return reader; } /// /// 读取单个值 /// /// /// /// ///public static int ExecuteScalar(CommandType cmdType, string sql, SqlParameter[] parms) { int result = -1; //连接数据库 using (SqlConnection con = new SqlConnection(str)) { //执行 SqlCommand cmd = new SqlCommand(); PrepareSQLCommand(cmdType, sql, parms, con, cmd); result = (int)cmd.ExecuteScalar(); return result; } } } }
--创建用户信息表 create database test; create table log4j ( id int identity(1,1) not null primary key, stamp varchar(10)not null, thread varchar(30)not null, clazz varchar(15)not null, infoLevel varchar(15)not null, message varchar(250) ) insert into log4j values('dddddd','aaaaa','dsfdfsfs','fdsffas'); create table tb_charts ( team varchar(50), Points varchar(50) ) insert into tb_charts values('Java','33'); insert into tb_charts values('C++','33'); insert into tb_charts values('Android','33'); insert into tb_charts values('PHP','33'); insert into tb_charts values('C#,ASP.NET','33'); insert into tb_charts values('Oracle','33'); insert into tb_charts values('F','33'); select * from tb_charts;
源代码:http://download.csdn.net/detail/l_ji_l/4336918