Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            kullanicilar k = new kullanicilar();

            k.tel = textBoxTel.Text;
            try
            {
                SqlConnection con = new SqlConnection("Data Source=ASUSN750JK;Initial Catalog=DemirbasDB;Integrated Security=True");

                con.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;

                cmd.CommandText = "INSERT INTO personelTablo(Ad,Soyad,tel,Il,Adres,kullanıcıAd,kullaniciSifre,Dept) VALUES('" + textBoxAd.Text + "','" + textBoxSoyad.Text + "','" + textBoxTel.Text + "','" + textBoxIl.Text + "','" + textBoxAdres.Text + "','" + textBoxKullaniciAdi.Text + "','" + textBoxSifre.Text + "','" + comboBox1.Text + "')";

                cmd.CommandType = CommandType.Text;

                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                DataSet ds = new DataSet();
                da.Fill(ds);


                con.Close();

                MessageBox.Show("urun eklendi");
            }
            catch
            {
                MessageBox.Show("girdiğiniz telefone numarası: " + k.tel + " şeklinde olmamalı.535-5455464 şeklinde olmalıdır.");
            }
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            kullanicilar k = new kullanicilar();

            k.tel = textBoxTel.Text;
            //try
            //{

            cmd = new SqlCommand();
            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "update personelTablo set Ad='" + textBoxAd.Text + "',Soyad='" + textBoxSoyad.Text + "',tel='" + textBoxTel.Text + "',Il='" + textBoxIl.Text + "',Adres='" + textBoxAdres.Text + "',kullanıcıAd='" + textBoxKullaniciAdi.Text + "',kullaniciSifre='" + textBoxSifre.Text + "',Dept='" + comboBox1.Text + "';";
            cmd.ExecuteNonQuery();
            con.Close();
            Goster();
            MessageBox.Show("Personel güncellendi");
        }