-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrmKulup.cs
103 lines (90 loc) · 3.26 KB
/
FrmKulup.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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 BonusProje1
{
public partial class FrmKulup : Form
{
public FrmKulup()
{
InitializeComponent();
}
SqlConnection baglanti = new SqlConnection(@"Data Source=DESKTOP-1C38CAO\SQLEXPRESS01;Initial Catalog=BonusOkul;Integrated Security=True");
private void label2_Click(object sender, EventArgs e)
{
}
void liste()
{
SqlDataAdapter da = new SqlDataAdapter("Select * from TBLKULUPLER", baglanti);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
private void FrmKulup_Load(object sender, EventArgs e)
{
liste();
}
private void BtnListele_Click(object sender, EventArgs e)
{
liste();
}
private void BtnEkle_Click(object sender, EventArgs e)
{
baglanti.Open();
SqlCommand komut = new SqlCommand("insert into TBLKULUPLER (KULUPAD) VALUES (@P1)", baglanti);
komut.Parameters.AddWithValue("@P1",TxtKulupAd.Text);
komut.ExecuteNonQuery();
baglanti.Close();
MessageBox.Show("Kulüp Listeye Eklendi","Bilgi",MessageBoxButtons.OK,MessageBoxIcon.Information);
liste();
}
private void pictureBox6_Click(object sender, EventArgs e)
{
this.Hide();
}
private void pictureBox6_MouseHover(object sender, EventArgs e)
{
pictureBox6.BackColor = Color.Black;
}
private void pictureBox6_MouseLeave(object sender, EventArgs e)
{
pictureBox6.BackColor = Color.Transparent;
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
TxtKulupID.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
TxtKulupAd.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
}
private void BtnSil_Click(object sender, EventArgs e)
{
baglanti.Open();
SqlCommand komut = new SqlCommand("Delete From TBLKULUPLER where KULUPID=@P1", baglanti);
komut.Parameters.AddWithValue("@P1", TxtKulupID.Text);
komut.ExecuteNonQuery();
baglanti.Close();
MessageBox.Show("Kulüp Silme İşlemi Gerçekleşti");
liste();
}
private void BtnGuncelle_Click(object sender, EventArgs e)
{
baglanti.Open();
SqlCommand komut = new SqlCommand("Update TBLKULUPLER set KULUPAD=@P1 where KULUPID=@P2", baglanti);
komut.Parameters.AddWithValue("@P1", TxtKulupAd.Text);
komut.Parameters.AddWithValue("@P2", TxtKulupID.Text);
komut.ExecuteNonQuery();
baglanti.Close();
MessageBox.Show("Kulüp Güncelleme İşlemi Gerçekleşti");
liste();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}