Report statistics (4) Database Access

Source: Internet
Author: User

View code

 Protected   Void Page_load ( Object  Sender, eventargs e ){  If (! Ispostback) {createtempchart ();}}  Public   Void  Createtempchart () {sqlconnection con = New Sqlconnection ( " Data Source =.; initial catalog = demo; Integrated Security = true  "  );  String Strsql = "  Select productprice, worker from chartdb  "  ; Sqlcommand cmd = New  Sqlcommand (strsql, con); con. open (); sqldatareader Dr = Cmd. executereader ();  This . Chart1.width =600  ;  This . Chart1.height = 400  ;  This . Chart1.chartareas [ 0 ]. Axisx. Title = "  Sales Staff  "  ;  This . Chart1.chartareas [ 0 ]. Axisy. Title = "  Sales revenue "  ;  This . Chart1.series [ 0 ]. Charttype = System. Web. UI. datavisualization. charting. seriescharttype. line;  This . Chart1.series [ 0 ]. Isvalueshownaslabel = True  ;  This . Chart1.series [ 0 ]. Markerstyle = System. Web. UI. datavisualization. charting. markerstyle. triangle; This . Chart1.titles. Add ( "  Sales Status  "  );  For ( Int I = 0 ; I < This . Chart1.legends. Count; I ++ ){  This . Chart1.legends [I]. legendstyle = System. Web. UI. datavisualization. charting. legendstyle. row;  This . Chart1.legends [I]. Docking = System. Web. UI. datavisualization. charting. Docking. bottom;  This . Chart1.legends [I]. Alignment = System. Drawing. stringalignment. Center ;}  This . Chart1.series [ 0 ]. Legendtext = "  Sales  "  ;  This . Chart1.series [ 0 ]. Tooltip = " Sales: \ t # valx \ n revenue: \ t # Valy  "  ;  This . Chart1.series [ 0 ]. Points. databindxy (DR, "  Worker  " , Dr, "  Productprice  "  ); Dr. Close (); con. Close ();  This  . Chart1.databind ();} 

databindxy method used

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.