11 Ağustos 2019 Pazar

C# Sinema Otomasyonu Seans Listeleme


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 WindowsFormsApp2
{
    public partial class frmSeansListele : Form
    {
        public frmSeansListele()
        {
            InitializeComponent();
        }
        SqlConnection baglanti = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=Sinema_Bileti;Integrated Security=True");
       DataTable tablo = new DataTable();
        private void button1_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }
        private void SeansListesi(string sql)
        {
           

            baglanti.Open();
            SqlDataAdapter adtr = new SqlDataAdapter(sql, baglanti);
            adtr.Fill(tablo);
            dataGridView1.DataSource = tablo;
            baglanti.Close();

        }

        private void frmSeansListele_Load(object sender, EventArgs e)
        {

            tablo.Clear();
         SeansListesi("select*from seans_bilgileri where tarih like'" + dateTimePicker1.Text + "'");
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            tablo.Clear();
            SeansListesi("select*from seans_bilgileri where tarih like'" + dateTimePicker1.Text + "'");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            tablo.Clear();
            SeansListesi("select*from seans_bilgileri ");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            tablo.Clear();
            Form2 zz = new Form2();
            zz.ShowDialog();
        }
    }
}

Hiç yorum yok:

Yorum Gönder