.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

C# Chart Control Tutorial In Urdu - Load Data Dynamically in Chart Control

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh



C# Code

using System;
using System.Data;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;

namespace ChartDemoVC3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
FromComboBox.Text = "2012";
ToComboBox.Text = "2015";

LoadData();
}

private void LoadData()
{
SalesByYearChart.DataSource = GetData();
SalesByYearChart.Series["Series1"].Points.Clear();
SalesByYearChart.Series["Series1"].XValueMember = "Year";
SalesByYearChart.Series["Series1"].YValueMembers = "Total";
}

// DataSet, Objects, Array, Collection, Generics, DataTable
private DataTable GetData()
{
DataTable dtChartData = new DataTable();

using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbx"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("usp_ChartData2", conn))
{
cmd.CommandType = CommandType.StoredProcedure;

conn.Open();

cmd.Parameters.AddWithValue("@FromYear", FromComboBox.Text);
cmd.Parameters.AddWithValue("@ToYear", ToComboBox.Text);

SqlDataReader reader = cmd.ExecuteReader();

dtChartData.Load(reader);
}
}

return dtChartData;
}

private void GoButton_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

Stored Procedure: [dbo].[usp_ChartData2]

CREATE PROCEDURE [dbo].[usp_ChartData2]
(
@FromYear NVARCHAR(50)
,@ToYear NVARCHAR(50)
)
AS

BEGIN

SELECT SUM([Total]) AS 'Total'
,DATEPART(yyyy, [DateOfOrder]) AS 'Year'
FROM [dbo].[Orders]
GROUP BY DATEPART(yyyy, [DateOfOrder])
HAVING DATEPART(yyyy, [DateOfOrder]) >= @FromYear AND DATEPART(yyyy, [DateOfOrder]) <= @ToYear

END

Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel C# Chart Control Tutorial In Urdu - Load Data Dynamically in Chart Control, Diterbitkan oleh scodeaplikasi pada Sabtu, 30 Januari 2016. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to