資源簡介
只需要一條SQL語句,即可完美展現(xiàn)動態(tài)統(tǒng)計圖(柱狀圖、餅狀圖、3D柱狀圖等等),本實例是ASP.NET + SQLServer的,把解壓后放到同一個目錄,然后發(fā)布至IIS即可測試,有任何問題留言我

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Drawing;
using?WebChart;
using?System.Data;
using?System.Data.SqlClient;
using?System.Text;?
using?System.xml;
using?System.IO;
public?partial?class?Default3?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????getData();
????????//Button4();
???????//?btn2();
????}
????//獲取數(shù)據(jù)
????protected?DataSet?getData()
????{
????????DataSet?ds?=?new?DataSet();
????????try
????????{
????????????string?connectionString?=?“Data?Source=.;Initial?Catalog=ERP_OA;?Persist?Security?Info=True;User?ID=sa;Password=123456“;
????????????SqlConnection?con?=?new?SqlConnection(connectionString);
????????????con.Open();
????????????//把xml中name顯示的的數(shù)據(jù)列添加別名為name,value顯示的數(shù)據(jù)列添加別名為value
????????????string?cmdstring?=?“SELECT?bumenname?as?nameid?as?value?from?erpbumen?where?id?<20?for?xml?autotype“;
???????????
????????????SqlCommand?cmd?=?new?SqlCommand(cmdstring?con);
????????????SqlDataAdapter?da?=?new?SqlDataAdapter(cmd);
????????????da.Fill(ds);
????????????string?a?=?ds.Getxml().ToString();
????????????a?=?a.Replace(“erpbumen““set“);
????????????
????????????con.Close();
????????????
????????a?=?a.Replace(“l?version=\“1.0\“?>“““);
????????a?=?a.Replace(““?““);
????????a?=?a.Replace(“ “?““);
????????a?=?a.Replace(““?““);
????????a?=?a.Replace(“
“?““);
????????a?=?a.Replace(““?““);
????????a?=?a.Replace(“ “?““);
????????
????????a?=?“l?version=\“1.0\“?encoding=\“utf-8\“?>“?+?a?+?“ “;
????????a?=?a.Replace(“<“?“<“);
????????a?=?a.Replace(“>““>“);
????????xmlDocument?xmldoc?=?new?xmlDocument();?//創(chuàng)建空的xml文檔?
???????????
????????xmldoc.Loadxml(a);
???????xmldoc.Save(Server.MapPath(“Data.xml“));?//保存?
????????}
????????catch?(Exception?ex)
????????{
????????????Response.Write(ex.Message);
????????}
???????
????????return?ds;
????}
????//gridview數(shù)據(jù)綁定
???
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1119??2015-09-11?10:36??Default3.aspx
?????文件???????2350??2015-09-11?10:53??Default3.aspx.cs
?????文件????????374??2015-09-11?10:37??Data.xm
-----------?---------??----------?-----??----
?????????????????3843????????????????????3
- 上一篇:C#上位機(jī)串口通信助手源代碼
- 下一篇:通過修改屬性表完成shp文件的修改
評論
共有 條評論