コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            baglanti.Open();
            string     secmeSorgusu2 = "SELECT * from DrugManufacturer_table where CompanyId=@CompanyId";
            SqlCommand secmeKomutu2  = new SqlCommand(secmeSorgusu2, baglanti);

            secmeKomutu2.Parameters.AddWithValue("@CompanyId", textBox8.Text);
            SqlDataAdapter da1 = new SqlDataAdapter(secmeKomutu2);
            SqlDataReader  dr3 = secmeKomutu2.ExecuteReader();

            if (dr3.Read())
            {
                string ID = dr3["CompanyId"].ToString();
                dr3.Close();
                DialogResult durum = MessageBox.Show(ID + " numaralı kaydı silmek istediğinizden emin misiniz?", "Silme Onayı", MessageBoxButtons.YesNo);

                if (DialogResult.Yes == durum)
                {
                    string     silmeSorgusu2 = "DELETE from DrugManufacturer_table where CompanyId=@CompanyId";
                    SqlCommand silKomutu2    = new SqlCommand(silmeSorgusu2, baglanti);
                    silKomutu2.Parameters.AddWithValue("@CompanyId", textBox8.Text);
                    silKomutu2.ExecuteNonQuery();
                    MessageBox.Show("Kayıt Silindi.");
                    textBox8.Clear();
                }
            }
            dr3.Close();
            baglanti.Close();

            DrugManufacturer tedarikci = new DrugManufacturer();

            tedarikci.Show();
            this.Hide();
        }
コード例 #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            DrugManufacturer tedarikci = new DrugManufacturer();

            tedarikci.Show();
            this.Hide();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text == "") | (textBox2.Text == "") | (textBox3.Text == "") | (textBox4.Text == ""))
            {
                MessageBox.Show("Boş alanları doldurunuz.");
            }
            else
            {
                try
                {
                    baglanti.Open();
                    string     kayit = "insert into DrugManufacturer_table(CompanyId,CompanyName,Adress,PhoneNumber) values (@CompanyId,@CompanyName,@Adress,@PhoneNumber)";
                    SqlCommand cmd   = new SqlCommand(kayit, baglanti);

                    cmd.Connection = baglanti;
                    cmd.Parameters.AddWithValue("@CompanyId", int.Parse(textBox1.Text));
                    cmd.Parameters.AddWithValue("@CompanyName", textBox2.Text);
                    cmd.Parameters.AddWithValue("@Adress", textBox3.Text);
                    cmd.Parameters.AddWithValue("@PhoneNumber", textBox4.Text);

                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    baglanti.Close();
                    MessageBox.Show("Yeni tedarikçi bilgileri eklendi.");
                    DrugManufacturer tedarikci = new DrugManufacturer();
                    tedarikci.Show();
                    this.Hide();
                }
            }
        }