-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form5.cs
112 lines (93 loc) · 3 KB
/
Form5.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
104
105
106
107
108
109
110
111
112
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 SirketProjem
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
SqlConnection baglan = new SqlConnection(@"Server=LAPTOP-I1EN423K\MSSQLSERVER01;Initial Catalog=TravelTraffik ;Integrated Security=True;");
private void BtnGeriF5_Click(object sender, EventArgs e)
{
Form3 Form3 = new Form3();
Form3.Show();
this.Hide();
}
private void btnKaydetF5_Click(object sender, EventArgs e)
{
}
private void BtnAraF5_Click(object sender, EventArgs e)
{
try
{
baglan.Open();
string querry = " SELECT Name , LastName , BillNo FROM insertCustomer WHERE Name = @Name ";
SqlCommand cmd = new SqlCommand(querry, baglan);
cmd.Parameters.AddWithValue("@Name", txtBoxAra.Text);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataTable dtb = new DataTable();
dtb.Clear();
sda.Fill(dtb);
dataGridView1.DataSource = dtb;
dataGridView1.AllowUserToAddRows = false;
}
catch (Exception ex)
{
MessageBox.Show("Bir Hata oluştu lütfen daha sonra deneyiniz " + ex);
}
finally
{
baglan.Close();
}
}
private void Form5_Load(object sender, EventArgs e)
{
try
{
baglan.Open();
SqlCommand cmd = new SqlCommand("SELECT Name, LastName, BillNo FROM insertCustomer", baglan);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dtb = new DataTable();
sda.Fill(dtb);
dataGridView1.DataSource = dtb; // DataTable'ı dataGridView'e bağlayın
}
catch (Exception ex)
{
MessageBox.Show("Bir hata oluştu, lütfen birazdan tekrar deneyiniz: " + ex.Message);
}
finally
{
baglan.Close();
}
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form7 Form7 = new Form7();
Form7.Show();
this.Hide();
}
private void BtnSilMusteriF5_Click(object sender, EventArgs e)
{
Form8 Form8 = new Form8();
Form8.Show();
this.Hide();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
}
}
}