-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmMusteriEkle.cs
51 lines (46 loc) · 1.62 KB
/
frmMusteriEkle.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
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 StokTkip
{
public partial class frmMusteriEkle : Form
{
public frmMusteriEkle()
{
InitializeComponent();
}
static string conString = "Data Source=DESKTOP-POJFHO5;Initial Catalog=StokTKP;Integrated Security=True";
SqlConnection baglantı = new SqlConnection(conString);
private void frmMusteriEkle_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
baglantı.Open();
string kayıt = "insert into musteri(tc ,adsoyad , telefon , adres, email) values(@tc ,@adsoyad , @telefon , @adres, @email)";
SqlCommand komut = new SqlCommand(kayıt, baglantı);
komut.Parameters.AddWithValue("@tc", txtTC.Text);
komut.Parameters.AddWithValue("@adsoyad", txtadsoyad.Text);
komut.Parameters.AddWithValue("@telefon", txttelefon.Text);
komut.Parameters.AddWithValue("@adres", txtadres.Text);
komut.Parameters.AddWithValue("@email", txtemail.Text);
komut.ExecuteNonQuery();
baglantı.Close();
MessageBox.Show("Müşteri eklendi");
foreach (Control item in Controls)
{
if (item is TextBox)
{
item.Text = "";
}
}
}
}
}