-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm6.cs
More file actions
65 lines (59 loc) · 2.13 KB
/
Form6.cs
File metadata and controls
65 lines (59 loc) · 2.13 KB
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DatabaseProject
{
public partial class Form6 : Form
{
Form3 f3;
//const string constr = @"Data Source=DESKTOP-SIPFLUH\DBSML3;Initial Catalog=dbproj;Integrated Security=SSPI";
const string constr = @"Data Source = ROHAN-PC\SPARTA; Initial Catalog = dbproj ;Integrated Security = SSPI";
SqlConnection con = new SqlConnection(constr);
SqlCommand cm = new SqlCommand();
public Form6()
{
InitializeComponent();
//this.f3 = frm3;
}
private void LoadOrders()
{
// TODO: Complete the function LoadOrders
// SQL Query to Select all records from orders table in the descending order of order date
con.Open();
string sql = "select * from [EmployeeDetails] where first_name = '" + "Rohan" + "'";
cm = new SqlCommand(sql, con);
SqlDataAdapter da = new SqlDataAdapter(cm);
DataTable d = new DataTable();
da.Fill(d);
cm.Dispose();
con.Close();
dataGridView1.DataSource = d;
dataGridView1.BackgroundColor = Color.White;
dataGridView1.RowHeadersVisible = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
}
private void Form6_Load(object sender, EventArgs e)
{
dataGridView1.BackgroundColor = Color.White;
dataGridView1.RowHeadersVisible = false;
LoadOrders();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
Form3 f = new Form3(f1);
f.Show();
this.Close();
}
}
}