-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdmin_View.cs
66 lines (56 loc) · 1.8 KB
/
Admin_View.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
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Cafe_Management_Mini_Project
{
public partial class Admin_View : Form
{
SqlConnection Conn;
public Admin_View()
{
InitializeComponent();
Conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Reliance\Desktop\Github\C-_Mini_Project-Cafe-Management\CafeMenu\Database1.mdf;Integrated Security=True");
}
private void Admin_View_Load(object sender, EventArgs e)
{
try
{
Conn.Open();
string Query = "select * from customer_data";
SqlCommand cmd = new SqlCommand(Query, Conn);
cmd.ExecuteNonQuery();
DataTable td = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
sda.Fill(td);
if (td.Rows.Count > 0)
{
Datagrid1.DataSource = td;
}
else
{
MessageBox.Show("Sorry! No data Found", "No data");
}
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message, "Error");
}
}
private void Admin_View_FormClosing(object sender, FormClosingEventArgs e)
{
Login frm = new Login();
frm.Show();
}
private void Datagrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}