-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemSize.cs
54 lines (43 loc) · 1.49 KB
/
ItemSize.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Sales_and_Inventory_System__Gadgets_Shop_
{
public partial class ItemSize : Form
{
SqlDataReader rdr = null;
DataTable dtable = new DataTable();
SqlConnection con = null;
SqlCommand cmd = null;
DataTable dt = new DataTable();
ConnectionString cs = new ConnectionString();
public ItemSize()
{
InitializeComponent();
}
private void ItemSize_Load(object sender, EventArgs e)
{
try
{
con = new SqlConnection(cs.DBConn);
con.Open();
cmd = new SqlCommand("SELECT RTRIM(Date) as [Date],RTRIM(Name) as [User Name],RTRIM(Amount) as [Amount] from BalanceHistory order by Date desc", con);
SqlDataAdapter myDA = new SqlDataAdapter(cmd);
DataSet myDataSet = new DataSet();
myDA.Fill(myDataSet, "BalanceHistory");
dataGridView1.DataSource = myDataSet.Tables["BalanceHistory"].DefaultView;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}