private void goruntu_btn_Click(object sender, EventArgs e) { try { string MyConnection2 = "server=localhost;user id=root;database=gocmenotomasyon"; string Query = "SELECT * FROM tbl_gocmen_ulkesi "; MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void yenile_btn_Click(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `sehir_id`, `sehir_ad` FROM `tbl_kaldigi_sehir`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void goc_guncelleme_ekrani_Load(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `goc_id`, `goc_tur`, `goc_trh` FROM `tbl_goc`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void yardimk_guncelleme_ekrani_Load(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `yk_id`, `yk_ad` FROM `tbl_yardim_kurulus`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void Form2_Load(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `meslek_id`, `meslek_ad` FROM `tbl_meslek`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void kamp_guncelleme_ekrani_Load(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `kamp_id`, `sehir_id`, `kamp_ad`, `kurul_trh` FROM `tbl_kamp`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void yenile_btn_Click(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `gocmen_id`, `goc_id`, `ulke_id`, `sehir_id`, `kamp_id`, `meslek_id`, `gocmen_ad`, `gocmen_soyad`, `gocmen_yas`, `gocmen_cinsiyet`, `gocmen_egitim_duzeyi` FROM `tbl_gocmen`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void yenile_btn_Click(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); sda = new MySqlDataAdapter(@"SELECT `ulke_id`, `ulke_ad`, `ulke_uyruk` FROM `tbl_gocmen_ulkesi`", con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; }
private void baglanti_tablosu_Load(object sender, EventArgs e) { MySqlConnection MyConn2 = DaoClass.GetMySqlConnection(); string Query = "SELECT * FROM kamp_kurulus "; MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); con.Open(); MySqlCommand kk_connect = con.CreateCommand(); kk_connect.CommandType = CommandType.Text; kk_connect.CommandText = "SELECT * FROM tbl_kamp"; dr = kk_connect.ExecuteReader(); while (dr.Read()) { ComboboxItem item = new ComboboxItem(); item.Text = dr.GetString("kamp_ad"); item.Value = dr.GetString("kamp_id"); kamp_id.Items.Add(item); } con.Close(); con.Open(); MySqlCommand yk_connect = con.CreateCommand(); yk_connect.CommandType = CommandType.Text; yk_connect.CommandText = "SELECT * FROM tbl_yardim_kurulus"; dr1 = yk_connect.ExecuteReader(); while (dr1.Read()) { ComboboxItem item1 = new ComboboxItem(); item1.Text = dr1.GetString("yk_ad"); item1.Value = dr1.GetString("yk_id"); yk_id.Items.Add(item1); } con.Close(); }
private void goc_goruntu_Click(object sender, EventArgs e) { try { string Query = "SELECT * FROM tbl_goc "; MySqlConnection con = DaoClass.GetMySqlConnection(); MySqlCommand MyCommand2 = new MySqlCommand(Query, con); con.Open(); MySqlDataAdapter adapter = DaoClass.GetMySqlDataAdapter(); adapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); adapter.Fill(dTable); dataGridView1.DataSource = dTable; con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void yardımk_form_Load(object sender, EventArgs e) { string MyConnection2 = "server=localhost;user id=root;database=gocmenotomasyon"; string Query = "SELECT * FROM tbl_yardim_kurulus "; MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); }
private void baglan() { string bag; MySqlConnectionStringBuilder build = new MySqlConnectionStringBuilder(@"server=localhost;user id=root;database=gocmenotomasyon"); bag = build.ToString(); baglanti = new MySqlConnection(bag); string sql = "SELECT * FROM tbl_kaldigi_sehir"; DataTable dt = new DataTable(); MySqlDataAdapter adapter = DaoClass.GetMySqlDataAdapter(); MySqlCommand command = new MySqlCommand(); command.CommandText = sql; command.Connection = baglanti; adapter.SelectCommand = command; baglanti.Open(); adapter.Fill(dt); dataGridView1.DataSource = dt; }
private void yardımk_silme_form_Load(object sender, EventArgs e) { string bag; MySqlConnectionStringBuilder build = new MySqlConnectionStringBuilder(@"server=localhost;user id=root;database=gocmenotomasyon"); bag = build.ToString(); baglanti = new MySqlConnection(bag); string sql = "SELECT * FROM tbl_yardim_kurulus"; DataTable dt = new DataTable(); MySqlDataAdapter adapter = DaoClass.GetMySqlDataAdapter(); MySqlCommand command = new MySqlCommand(); command.CommandText = sql; command.Connection = baglanti; adapter.SelectCommand = command; baglanti.Open(); adapter.Fill(dt); dataGridView1.DataSource = dt; }
private void lst_goc_Click(object sender, EventArgs e) { try { string MyConnection2 = "server=localhost;user id=root;database=gocmenotomasyon"; //Display query string Query = "select * from tbl_goc "; MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); //For offline connection we weill use MySqlDataAdapter class. MySqlDataAdapter MyAdapter = new MySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; // here i have assign dTable object to the dataGridView1 object to display data. MyConn2.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MySqlConnection con1 = DaoClass.GetMySqlConnection(); con1.Open(); string query = "SELECT COUNT(goc_id) FROM tbl_goc"; MySqlCommand command = new MySqlCommand(query, con1); MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { sayici.Text = dr.GetString(0); } con1.Close(); }
private void gorn_btn_Click(object sender, EventArgs e) { try { string Query = "SELECT k.kamp_id , k.kamp_ad , yk.yk_id , yk.yk_ad FROM tbl_kamp AS k INNER JOIN kamp_kurulus AS kk ON k.kamp_id = kk.kamp_id INNER JOIN tbl_yardim_kurulus AS yk ON kk.yk_id = yk.yk_id ORDER BY k.kamp_id "; MySqlConnection MyConn2 = DaoClass.GetMySqlConnection(); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void sil_Click(object sender, EventArgs e) { string bag; MySqlConnectionStringBuilder build = new MySqlConnectionStringBuilder(@"server=localhost;user id=root;database=gocmenotomasyon"); bag = build.ToString(); baglanti = new MySqlConnection(bag); string sql = "DELETE FROM tbl_yardim_kurulus WHERE yk_id= '" + giristxb.Text + "'"; DataTable dt = new DataTable(); MySqlDataAdapter adapter = DaoClass.GetMySqlDataAdapter(); MySqlCommand command = new MySqlCommand(); command.CommandText = sql; command.Connection = baglanti; adapter.SelectCommand = command; baglanti.Open(); adapter.Fill(dt); dataGridView1.DataSource = dt; baglan(); }
private void lst_goc_Click(object sender, EventArgs e) { try { string MyConnection2 = "server=localhost;user id=root;database=gocmenotomasyon"; string Query = "SELECT * FROM tbl_gocmen_ulkesi "; MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MySqlConnection con1 = DaoClass.GetMySqlConnection(); con1.Open(); string query = "SELECT COUNT(ulke_id) FROM tbl_gocmen_ulkesi"; MySqlCommand command = new MySqlCommand(query, con1); MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { sayici.Text = dr.GetString(0); } con1.Close(); }
private void ekleme_button_Click(object sender, EventArgs e) { MySqlConnection con = DaoClass.GetMySqlConnection(); con.Open(); MySqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO tbl_goc(goc_tur,goc_trh)VALUES('" + goc_tur.Text + "','" + goc_trh.Text + "')"; cmd.ExecuteNonQuery(); if (goc_tur is TextBox) { if (goc_tur.Text == String.Empty) { MessageBox.Show("Bu alan boş bırakılamaz!"); } else { MessageBox.Show("Kayıt veritabanına eklendi, işlemi görüntülemek için görüntüle butonuna basınız.."); } } con.Close(); }
private void ekle_forms_Load(object sender, EventArgs e) { string MyConnection2 = "server=localhost;user id=root;database=gocmenotomasyon"; string Query = "SELECT * FROM tbl_gocmen "; MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MyConn2.Open(); MySqlDataAdapter MyAdapter = DaoClass.GetMySqlDataAdapter(); MyAdapter.SelectCommand = MyCommand2; DataTable dTable = new DataTable(); MyAdapter.Fill(dTable); dataGridView1.DataSource = dTable; MyConn2.Close(); con.Open(); MySqlCommand goc_connect = con.CreateCommand(); goc_connect.CommandType = CommandType.Text; goc_connect.CommandText = "SELECT * FROM tbl_goc"; dr = goc_connect.ExecuteReader(); while (dr.Read()) { ComboboxItem item = new ComboboxItem(); item.Text = dr.GetString("goc_tur"); item.Value = dr.GetString("goc_id"); goc.Items.Add(item); } con.Close(); con.Open(); MySqlCommand ulke_connect = con.CreateCommand(); ulke_connect.CommandType = CommandType.Text; ulke_connect.CommandText = "SELECT * FROM tbl_gocmen_ulkesi"; dr1 = ulke_connect.ExecuteReader(); while (dr1.Read()) { ComboboxItem item1 = new ComboboxItem(); item1.Text = dr1.GetString("ulke_ad"); item1.Value = dr1.GetString("ulke_id"); ulke.Items.Add(item1); } con.Close(); con.Open(); MySqlCommand sehir_connect = con.CreateCommand(); sehir_connect.CommandType = CommandType.Text; sehir_connect.CommandText = "SELECT * FROM tbl_kaldigi_sehir"; dr2 = sehir_connect.ExecuteReader(); while (dr2.Read()) { ComboboxItem item2 = new ComboboxItem(); item2.Text = dr2.GetString("sehir_ad"); item2.Value = dr2.GetString("sehir_id"); sehiralani.Items.Add(item2); } con.Close(); con.Open(); MySqlCommand kampc_connect = con.CreateCommand(); kampc_connect.CommandType = CommandType.Text; kampc_connect.CommandText = "SELECT * FROM tbl_kamp"; dr3 = kampc_connect.ExecuteReader(); while (dr3.Read()) { ComboboxItem item3 = new ComboboxItem(); item3.Text = dr3.GetString("kamp_ad"); item3.Value = dr3.GetString("kamp_id"); kampalani.Items.Add(item3); } con.Close(); con.Open(); MySqlCommand meslek_connect = con.CreateCommand(); meslek_connect.CommandType = CommandType.Text; meslek_connect.CommandText = "SELECT * FROM tbl_meslek"; dr4 = meslek_connect.ExecuteReader(); while (dr4.Read()) { ComboboxItem item4 = new ComboboxItem(); item4.Text = dr4.GetString("meslek_ad"); item4.Value = dr4.GetString("meslek_id"); meslekalani.Items.Add(item4); } con.Close(); }