public void loadbukuta() { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "select * from buku_ta where id_bukuta=@idbukuta"; cmd.Connection = conn.myconnection(); cmd.Parameters.Add(new MySqlParameter("@idbukuta", this.idbukuta)); MySqlDataReader hasil = cmd.ExecuteReader(); if (hasil.Read()) { lblidbukuta.Text = hasil["id_bukuta"].ToString(); txtjudul.Text = hasil["judul"].ToString(); txtpengarang.Text = hasil["pengarang"].ToString(); txtnrp.Text = hasil["nrp"].ToString(); cbpembimbing.SelectedText = hasil["pembimbing"].ToString(); cbcopembimbing.SelectedText = hasil["co_pembimbing"].ToString(); cbtahun.SelectedText = hasil["tahun"].ToString(); txtabstrak.Text = hasil["abstrak"].ToString(); rbketerangan.Text = hasil["keterangan"].ToString(); cbkondisi.SelectedText = hasil["kondisi"].ToString(); cbpenguji1.SelectedText = hasil["penguji1"].ToString(); cbpenguji2.SelectedText = hasil["penguji2"].ToString(); cbpenguji3.SelectedText = hasil["penguji3"].ToString(); } hasil.Close(); }
void tampildata() { da = new MySqlDataAdapter("select * from cd", conn.myconnection()); ds = new DataSet(); da.Fill(ds, "cd"); dataGridView1.DataSource = ds.Tables["cd"]; dataGridView1.Refresh(); }
public void loaddata() { ds = new DataSet(); string query = "SELECT m.nama_mhs ,b.judul,( CASE WHEN p.STATUS = 1 THEN 'sedang pinjam' ELSE 'sudah dikembalikan' END ) AS 'status peminjaman',p.tgl_peminjaman FROM peminjaman p JOIN buku b ON b.kode = p.kode_buku LEFT JOIN mahasiswa m ON m.nrp = p.kode_peminjam WHERE 1 = 1"; da = new MySqlDataAdapter(query, conn.myconnection()); da.Fill(ds, "peminjaman"); dataGridView1.DataSource = ds.Tables["peminjaman"]; dataGridView1.Refresh(); }
public void loadcd() { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "select * from cd where id_cd=@idcd"; cmd.Connection = conn.myconnection(); cmd.Parameters.Add(new MySqlParameter("@idcd", this.idcd)); MySqlDataReader hasil = cmd.ExecuteReader(); if (hasil.Read()) { lblidcd.Text = hasil["id_cd"].ToString(); txtjudul.Text = hasil["judul"].ToString(); cbjenis.SelectedText = hasil["jenis"].ToString(); txtharga.Text = hasil["harga"].ToString(); rbketerangan.Text = hasil["keterangan"].ToString(); txtkode.Text = hasil["kode"].ToString();; cbkondisi.SelectedText = hasil["kondisi"].ToString();; txtrak.Text = hasil["rak"].ToString(); } hasil.Close(); }
public void loadbuku() { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "select * from buku where id_buku=@idbuku"; cmd.Connection = conn.myconnection(); cmd.Parameters.Add(new MySqlParameter("@idbuku", this.idbuku)); MySqlDataReader hasil = cmd.ExecuteReader(); if (hasil.Read()) { lblidbuku.Text = hasil["id_buku"].ToString(); txtjudul.Text = hasil["judul"].ToString(); txtsub.Text = hasil["sub_judul"].ToString(); txtkode.Text = hasil["kode"].ToString(); txtddc.Text = hasil["nama_DDC"].ToString(); cbsubjek.SelectedText = hasil["subjek"].ToString(); txtpengarang.Text = hasil["pengarang"].ToString(); txtpenerbit.Text = hasil["penerbit"].ToString(); txtkotaterbit.Text = hasil["kota_terbit"].ToString(); cbtahun.SelectedText = hasil["tahun_terbit"].ToString(); txtedisi.Text = hasil["edisi"].ToString(); txtvol.Text = hasil["volume"].ToString(); txtisbn.Text = hasil["ISBN"].ToString(); txtharga.Text = hasil["HARGA"].ToString(); txtbahasa.Text = hasil["bahasa"].ToString(); txtromawi.Text = hasil["halaman_romawi"].ToString(); txtarab.Text = hasil["halaman_arab"].ToString(); txttinggi.Text = hasil["tinggi"].ToString(); cbasli.SelectedText = hasil["keaslian"].ToString(); cbkondisi.SelectedText = hasil["kondisi"].ToString(); txtketerangan.Text = hasil["keterangan"].ToString(); txtnomorpanggil.Text = hasil["nomor_panggil"].ToString(); } hasil.Close(); }
private void Formcd_Load(object sender, EventArgs e) { ds = new DataSet(); conn = new connection(); try { string query = "Select * from cd where 1=1"; da = new MySqlDataAdapter(query, conn.myconnection()); da.Fill(ds, "cd"); dataGridView1.DataSource = ds.Tables["cd"]; dataGridView1.Refresh(); } catch (Exception ex) { } }
private void Formbuku_Load(object sender, EventArgs e) { ds = new DataSet(); conn = new connection(); try { string query = "Select * from buku where 1=1"; da = new MySqlDataAdapter(query, conn.myconnection()); da.Fill(ds, "buku"); dataGridView1.DataSource = ds.Tables["buku"]; dataGridView1.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void formpengembalian_Load(object sender, EventArgs e) { conn = new connection(); ds = new DataSet(); da = new MySqlDataAdapter(); try { string query = "SELECT m.nama_mhs ,b.judul,( CASE WHEN p.STATUS = 1 THEN 'sedang pinjam' ELSE 'sudah dikembalikan' END ) AS 'status peminjaman',p.tgl_peminjaman FROM peminjaman p JOIN buku b ON b.kode = p.kode_buku LEFT JOIN mahasiswa m ON m.nrp = p.kode_peminjam WHERE 1 = 1 and p.status=1"; da = new MySqlDataAdapter(query, conn.myconnection()); da.Fill(ds, "peminjaman"); dataGridView1.DataSource = ds.Tables["peminjaman"]; dataGridView1.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void btnsearch_Click(object sender, EventArgs e) { ds = new DataSet(); conn = new connection(); string query = "Select * from cd where 1=1"; try { query += " and judul='" + tbpencarian.Text + "'"; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } da = new MySqlDataAdapter(query, conn.myconnection()); //ds.Tables["buku"].Clear(); da.Fill(ds, "cd"); dataGridView1.DataSource = ds.Tables["cd"]; dataGridView1.Refresh(); }