zoukankan      html  css  js  c++  java
  • 点滴积累【C#】简单嵌套flash读取数据

    效果:

    说明:此效果只是简单的嵌套flash读取数据库中某两个字段的数据。(【js下载地址:http://163.fm/L6X8OAe  提取码:PRhkACbJ】 【swf下载地址:http://163.fm/Nqo2BPU   提取码:ot6Ws5zn 】    )

    事件:初始化加载。

    代码部分:

    HTML:

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head runat="server">
     3     <title></title>
     4     <script src="flash/FusionCharts.js"type="text/javascript"></script>
     5 </head>
     6 <body>
     7     <form id="form1" runat="server">
     8     <div>
     9         <table width="920" align="center" border="0" cellspacing="0" cellpadding="0" id="flash">
    10             <tr>
    11                 <td>
    12                     <div id="flashGO" style=" 900px; border: 1px #ccc solid;">
    13                     </div>
    14                 </td>
    15             </tr>
    16         </table>
    17     </div>
    18     </form>
    19 
    20     <script type="text/javascript">
    21         getchart('flash/Column3D.swf');
    22         function getchart(str) {
    23             var chart = new FusionCharts(str, "ChartId", "900", "400");
    24             chart.setDataXML('<?xml version="1.0" encoding="UTF-8" ?>'+
    25             '<chart caption="青苹果数据分析"  bgColor="#ffffff" xAxisName="试验室检测项目" yAxisName="总条数"' +
    26                 ' numberPrefix="" sformatNumberScale="1"  syncAxisLimits="10" rotateValues="0" showSum="0" baseFontSize="12">' +
    27                 /***生成柱状图*************************************************/
    28                        <%=flash %>
    29             /************************************************************/
    30                 '</chart>');
    31             chart.render("flashGO");
    32         }
    33     </script>
    34 
    35 </body>
    36 </html>

    后台:

     1 namespace qiantaoflash
     2 {
     3     public partial class _Default : System.Web.UI.Page
     4     {
     5         SqlConnection con = new SqlConnection("server=NEWSPRING;database=QG_Mis;uid=sa;pwd=pass@word1");
     6         protected void Page_Load(object sender, EventArgs e)
     7         {
     8             GetData();
     9         }
    10         public string flash = string.Empty;
    11         protected void GetData()
    12         {
    13             string sql = string.Format(@"SELECT TOP 30 * FROM ly_tzk");
    14             DataSet ds = new DataSet();
    15             SqlDataAdapter sda = new SqlDataAdapter(sql, con);
    16             sda.Fill(ds);
    17             foreach (DataRow dr in ds.Tables[0].Rows)
    18             {
    19                 flash += "'<set label=" + '"' + dr["xmmc"].ToString() + '"' + "value=" + '"' + dr["MenuID"].ToString() + '"' + "/>'+";
    20             }
    21         }
    22     }
    23 }
  • 相关阅读:
    C# WinForm API 改进单实例运行
    CF1310D Tourism [随机化]
    CF1311E Construct the Binary Tree
    [IOI2018] werewolf 狼人 [kruskal重构树+主席树]
    #6029. 「雅礼集训 2017 Day1」市场 [线段树]
    P5840 [COCI2015]Divljak [AC自动机,链并]
    CF547E Mike and Friends [AC自动机,离线树状数组]
    P5112 FZOUTSY
    CF 150E Freezing with Style [长链剖分,线段树]
    CF1230E Kamil and Making a Stream
  • 原文地址:https://www.cnblogs.com/xinchun/p/3116251.html
Copyright © 2011-2022 走看看