Ejemplo n.º 1
0
        public DataTable carimahasiswa(string cari)
        {
            sambung = new Koneksi();
            sql     = "SELECT biodata_mahasiswa.stb, biodata_mahasiswa.nama, program_studi.nama as prodi, " +
                      "agama.nama as agama, biodata_mahasiswa.tempat_lahir, biodata_mahasiswa.tanggal_lahir, " +
                      "biodata_mahasiswa.jenis_kelamin, biodata_mahasiswa.alamat, biodata_mahasiswa.kota, " +
                      "propinsi.nama as provinsi, biodata_mahasiswa.kode_pos, biodata_mahasiswa.telpon, " +
                      "biodata_mahasiswa.handphone, biodata_mahasiswa.hobi, biodata_mahasiswa.wali, " +
                      "biodata_mahasiswa.alamat_wali, biodata_mahasiswa.telpon_wali, biodata_mahasiswa.tahun_masuk " +
                      "from biodata_mahasiswa inner join program_studi on biodata_mahasiswa.kode_program_studi = program_studi.kode_prodi " +
                      "INNER join agama on agama.kode_agama = biodata_mahasiswa.kode_agama " +
                      "INNER JOIN propinsi on propinsi.kode_propinsi = biodata_mahasiswa.kode_propinsi " +
                      "where biodata_mahasiswa.stb LIKE '%" + cari + "%' or biodata_mahasiswa.nama LIKE '%" + cari + "%' ";
            tabel = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
Ejemplo n.º 2
0
        void Button1Click(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] photo = new byte[ms.Length];
            ms.Position = 0;
            ms.Read(photo, 0, photo.Length);
            sql = "INSERT INTO buku (kode_buku, kode_kategori, judul, jumlah, stock, pengarang, penerbit, tahun_terbit, " +
                  "tahun_pengadaan, sumber, rak, ISBN, foto, last_update, userid) " +
                  "VALUES ('" + textBox1.Text + "', '" + comboBox1.SelectedItem + "', '" + textBox3.Text + "', " + numericUpDown1.Value + ", " + textBox4.Text + ", '" + textBox5.Text + "', '" + textBox6.Text + "', '" + comboBox2.SelectedItem + "', '" + comboBox3.SelectedItem + "', " +
                  "'" + textBox7.Text + "', '" + textBox8.Text + "', '" + textBox9.Text + "', '" + photo + "', NOW(), 1)";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Disimpan !!", "information");
                bersihkan();
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
        void Button1Click(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            cek     = "SELECT COUNT(nomor_anggota) FROM `peminjaman_buku` WHERE nomor_anggota =" + noAgt.SelectedItem + " " +
                      "AND tanggal_pengembalian is NULL";
            try{
                sambung.buka();
                query = new MySqlCommand(cek, sambung.koneksi);
                dr    = query.ExecuteReader();
                dr.Read();
                if (Convert.ToInt16(dr[0].ToString()) >= 3)
                {
                    MessageBox.Show("Maksimum 3 peminjaman", "information..!!");
                }
                else
                {
                    dr.Close();
                    cek = "SELECT COUNT(nomor_anggota) FROM `peminjaman_buku` WHERE nomor_anggota =" + noAgt.SelectedItem + " " +
                          "AND tanggal_pengembalian is NULL AND kode_buku = '" + kodebuku.SelectedItem + "'";
                    query = new MySqlCommand(cek, sambung.koneksi);
                    dr    = query.ExecuteReader();
                    dr.Read();
                    if (Convert.ToInt16(dr[0].ToString()) >= 1)
                    {
                        MessageBox.Show("Buku Ini Telah Di pinjam Oleh Anggota Ini", "information..!!");
                    }
                    else
                    {
                        dr.Close();
                        sql = "insert into peminjaman_buku (nomor_anggota,kode_buku,tanggal_peminjaman,userid) " +
                              "values(" + noAgt.SelectedItem + ", '" + kodebuku.SelectedItem + "', '" + dateTimePicker1.Value.ToString("yyyyMMdd") + "', 1)";
                        query   = new MySqlCommand(sql, sambung.koneksi);
                        adapter = new MySqlDataAdapter(query);
                        query.ExecuteNonQuery();

                        updatestok = "update buku set stock = stock - 1";
                        query      = new MySqlCommand(updatestok, sambung.koneksi);
                        adapter    = new MySqlDataAdapter(query);
                        query.ExecuteNonQuery();
                        TampilDalamTable();
                        bersihkan();

                        MessageBox.Show("Data Berhasil Disimpan !!", "information");
                    }
                }
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
Ejemplo n.º 4
0
 void StbKeyPress(object sender, KeyPressEventArgs e)
 {
     sambung = new Koneksi();
     if (e.KeyChar == (char)Keys.Enter)
     {
         sql = "SELECT * FROM biodata_mahasiswa where stb=" + stb.Text;
         try{
             sambung.buka();
             query   = new MySqlCommand(sql, sambung.koneksi);
             adapter = new MySqlDataAdapter(query);
             dr      = query.ExecuteReader();
             if (dr.Read())
             {
                 MessageBox.Show("Data Sudah Ada", "information");
                 stb.Text             = dr["stb"].ToString();
                 nama.Text            = dr["nama"].ToString();
                 prodi.Text           = dr["kode_program_studi"].ToString();
                 agama.Text           = dr["kode_agama"].ToString();
                 tempatlahir.Text     = dr["tempat_lahir"].ToString();
                 dateTimePicker1.Text = dr["tanggal_lahir"].ToString();
                 jkel.Text            = dr["jenis_kelamin"].ToString();
                 alamat.Text          = dr["alamat"].ToString();
                 kota.Text            = dr["kota"].ToString();
                 propinsi.Text        = dr["kode_propinsi"].ToString();
                 kodepos.Text         = dr["kode_pos"].ToString();
                 telepon.Text         = dr["telpon"].ToString();
                 hp.Text         = dr["handphone"].ToString();
                 hobi.Text       = dr["hobi"].ToString();
                 wali.Text       = dr["wali"].ToString();
                 alamatwali.Text = dr["alamat_wali"].ToString();
                 telwali.Text    = dr["telpon_wali"].ToString();
                 tahunmasuk.Text = dr["tahun_masuk"].ToString();
                 button2.Enabled = true;
                 button3.Enabled = true;
                 button1.Enabled = false;
                 stb.ReadOnly    = true;
             }
             else
             {
                 nama.Select();
                 button1.Enabled = true;
             }
             sambung.tutup();
         } catch (Exception er) {
             MessageBox.Show(er.Message);
         }
     }
 }
        void TextBox1KeyPress(object sender, KeyPressEventArgs e)
        {
            sambung = new Koneksi();
            if (e.KeyChar == (char)Keys.Enter)
            {
                sql =
                    "select biodata_mahasiswa.nama from anggota_perpustakaan " +
                    "inner join biodata_mahasiswa on biodata_mahasiswa.stb = anggota_perpustakaan.nomor " +
                    "where anggota_perpustakaan.nomor =" + textBox1.Text;
                try{
                    sambung.buka();
                    query = new MySqlCommand(sql, sambung.koneksi);
                    dr    = query.ExecuteReader();

                    if (dr.Read() == true)
                    {
                        button1.Enabled = false;
                        MessageBox.Show("Anda Telah Terdaftar sebagai Anggota");
                        textBox2.Text = dr[0].ToString();
                    }
                    else if (dr.Read() == false)
                    {
                        sql = "select nama from biodata_mahasiswa where stb=" + textBox1.Text;
                        dr.Close();
                        query = new MySqlCommand(sql, sambung.koneksi);
                        dr    = query.ExecuteReader();
                        if (dr.Read() == true)
                        {
                            button1.Enabled = true;
                            MessageBox.Show("STB " + textBox1.Text + " Tidak Terdaftar sebagai Anggota");
                            textBox2.Text = dr[0].ToString();
                        }
                        else
                        {
                            button1.Enabled = false;
                            textBox2.Clear();
                            MessageBox.Show("Anda Tidak Terdaftar sebagai Mahasiswa");
                        }
                    }

                    sambung.tutup();
                } catch (Exception er) {
                    MessageBox.Show(er.Message);
                }
            }
        }
Ejemplo n.º 6
0
        void EditClick(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "UPDATE mahasiswa SET nama ='Mimi Amelia' where id=4 ";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Diubah !!", "information");
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
Ejemplo n.º 7
0
        void ComboBox1SelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "SELECT nama FROM kategori_buku where kode_kategori ='" + comboBox1.SelectedItem + "' ";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                dr.Read();
                textBox2.Text = dr[0].ToString();

                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 8
0
        public DataTable bacasemua()
        {
            sambung = new Koneksi();
            sql     = "Select * From Mahasiswa";
            tabel   = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
Ejemplo n.º 9
0
        public DataTable tampilpencarian(string cari)
        {
            sambung = new Koneksi();
            sql     = "SELECT * FROM mahasiswa where nama LIKE '%" + cari + "%'";
            tabel   = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
 void Button1Click(object sender, EventArgs e)
 {
     sambung = new Koneksi();
     sql     = "insert into anggota_perpustakaan (nomor, tanggal_masuk,userid)" +
               "values (" + textBox1.Text + ",'" + dateTimePicker1.Value.ToString("yyyyMMdd") + "',1)";
     try{
         sambung.buka();
         query   = new MySqlCommand(sql, sambung.koneksi);
         adapter = new MySqlDataAdapter(query);
         query.ExecuteNonQuery();
         MessageBox.Show("Data Berhasil Disimpan !!", "information");
         bersihkan();
         TampilDalamTable();
     } catch (Exception er) {
         MessageBox.Show(er.Message);
     }
     sambung.tutup();
 }
Ejemplo n.º 11
0
        void Button3Click(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "DELETE FROM biodata_mahasiswa where stb='" + stb.Text + "' ";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Dihapus !!", "information");
                bersihkan();
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
Ejemplo n.º 12
0
        void HapusClick(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "DELETE FROM mahasiswa where id=7 ";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Dihapus !!", "information");
//				dataGridView1.Refresh();
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
        public void kode_buku()
        {
            sambung = new Koneksi();
            sql     = "SELECT kode_buku from peminjaman_buku where nomor_anggota = " + comboBox1.SelectedItem + " AND tanggal_pengembalian is NULL";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    comboBox2.Items.Add(dr[0].ToString());
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 14
0
 void EditClick(object sender, EventArgs e)
 {
     sambung = new Koneksi();
     sql     = "UPDATE mahasiswa SET nama ='" + nama.Text + "', alamat ='" + alamat.Text + "', " +
               "nilai_tugas=" + nt.Value + ", nilai_mid=" + nm.Value + ", " +
               "nilai_final=" + nf.Value + ", nilai_akhir='" + na.Text + "', nilai_huruf='" + nh.Text + "', " +
               "keterangan='" + keterangan.Text + "' where stb='" + stb.Text + "' ";
     try {
         sambung.buka();
         query   = new MySqlCommand(sql, sambung.koneksi);
         adapter = new MySqlDataAdapter(query);
         query.ExecuteNonQuery();
         MessageBox.Show("Data Berhasil Diubah !!", "information");
         TampilDalamTable();
     } catch (Exception er) {
         MessageBox.Show(er.Message);
     }
     sambung.tutup();
 }
        public void nomor_anggota()
        {
            sambung = new Koneksi();
            sql     = "SELECT distinct nomor_anggota FROM peminjaman_buku where tanggal_pengembalian is Null ";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    comboBox1.Items.Add(dr[0].ToString());
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 16
0
        public void kodepropinsi()
        {
            sambung = new Koneksi();
            sql     = "SELECT kode_propinsi FROM propinsi";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    propinsi.Items.Add(dr[0].ToString());
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 17
0
        void ProdiSelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "SELECT nama FROM program_studi where kode_prodi= '" + prodi.SelectedItem + "' ";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    tampilprodi.Text = dr[0].ToString();
                }
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
        void KodebukuSelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "SELECT judul, stock FROM buku where kode_buku ='" + kodebuku.SelectedItem + "' ";
            try{
                sambung.buka();
                query = new MySqlCommand(sql, sambung.koneksi);
                dr    = query.ExecuteReader();

                if (dr.Read())
                {
                    kdbuku.Text = dr[0].ToString();
                    stok.Text   = dr[1].ToString();
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
        public void nomor_anggota()
        {
            sambung = new Koneksi();
            sql     = "SELECT nomor FROM anggota_perpustakaan";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    noAgt.Items.Add(dr[0].ToString());
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 20
0
        public DataTable anggota_perpustakaan()
        {
            sambung = new Koneksi();
            sql     = "Select anggota_perpustakaan.nomor, biodata_mahasiswa.nama, anggota_perpustakaan.tanggal_masuk " +
                      "From anggota_perpustakaan inner join biodata_mahasiswa " +
                      "on anggota_perpustakaan.nomor = biodata_mahasiswa.stb";
            tabel = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
        void NoAgtSelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "SELECT biodata_mahasiswa.nama FROM anggota_perpustakaan " +
                      "inner join biodata_mahasiswa on anggota_perpustakaan.nomor = biodata_mahasiswa.stb " +
                      "where anggota_perpustakaan.nomor =" + noAgt.SelectedItem;
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                dr      = query.ExecuteReader();

                while (dr.Read())
                {
                    nomoragt.Text = dr[0].ToString();
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 22
0
        void SimpanClick(object sender, EventArgs e)
        {
//			InputDataMhs inputdatamhs = new InputDataMhs();
//			inputdatamhs.ShowDialog();
            sambung = new Koneksi();
            sql     = "INSERT INTO mahasiswa (stb, nama, alamat, nilai_tugas, nilai_mid, nilai_final, nilai_akhir, " +
                      "nilai_huruf, keterangan) VALUES ('172298', 'Brian', 'Citra Sudiang Indah', 67, 87, 77, 87, 'A', " +
                      "'Sangat Baik')";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Disimpan !!", "information");
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
Ejemplo n.º 23
0
        public DataTable databuku()
        {
            sambung = new Koneksi();
            sql     = "Select buku.kode_buku, kategori_buku.nama, buku.judul, buku.jumlah, " +
                      "buku.stock, buku.pengarang, buku.penerbit, buku.tahun_terbit, buku.tahun_pengadaan, " +
                      "buku.sumber, buku.rak, buku.ISBN, buku.foto from buku " +
                      "inner join kategori_buku on kategori_buku.kode_kategori = buku.kode_kategori ";
            tabel = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
Ejemplo n.º 24
0
        void StbKeyPress(object sender, KeyPressEventArgs e)
        {
            sambung = new Koneksi();
            if (e.KeyChar == (char)Keys.Enter)
            {
                sql = "SELECT * FROM mahasiswa where stb='" + stb.Text + "' ";
                try{
                    sambung.buka();
                    query   = new MySqlCommand(sql, sambung.koneksi);
                    adapter = new MySqlDataAdapter(query);
                    //				dr = new MySqlDataReader();
                    dr = query.ExecuteReader();


                    if (dr.Read())
                    {
                        MessageBox.Show("Data Sudah Ada", "information");
                        simpan.Enabled  = false;
                        edit.Enabled    = true;
                        hapus.Enabled   = true;
                        nama.Text       = dr[1].ToString();
                        alamat.Text     = dr[2].ToString();
                        nt.Value        = Convert.ToInt32(dr[3]);
                        nm.Value        = Convert.ToInt32(dr[4]);
                        nf.Value        = Convert.ToInt32(dr[5]);
                        na.Text         = dr[6].ToString();
                        nh.Text         = dr[7].ToString();
                        keterangan.Text = dr[8].ToString();
                    }
                    else
                    {
                        simpan.Enabled = true;
                        nama.Select();
                    }
                    sambung.tutup();
                } catch (Exception er) {
                    MessageBox.Show(er.Message);
                }
            }
        }
        void ComboBox2SelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            sql     = "SELECT buku.judul, peminjaman_buku.tanggal_peminjaman FROM peminjaman_buku " +
                      "inner join buku on buku.kode_buku = peminjaman_buku.kode_buku " +
                      "where nomor_anggota =" + comboBox1.SelectedItem + " and peminjaman_buku.kode_buku = '" + comboBox2.SelectedItem + "' " +
                      "and peminjaman_buku.tanggal_pengembalian is null";
            try{
                sambung.buka();
                query = new MySqlCommand(sql, sambung.koneksi);
                dr    = query.ExecuteReader();

                if (dr.Read())
                {
                    textBox2.Text        = dr[0].ToString();
                    dateTimePicker1.Text = dr[1].ToString();
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 26
0
        void Button1Click(object sender, EventArgs e)
        {
            sambung = new Koneksi();

            sql = "INSERT INTO biodata_mahasiswa (stb, nama, kode_program_studi, kode_agama, tempat_lahir," +
                  "tanggal_lahir, jenis_kelamin, alamat, kota, kode_propinsi, kode_pos, telpon," +
                  "handphone, hobi, wali, alamat_wali, telpon_wali, tahun_masuk, userid) " +
                  "VALUES (" + stb.Text + ", " +
                  "'" + nama.Text + "', " +
                  "'" + prodi.SelectedItem + "', " +
                  "'" + agama.SelectedItem + "', " +
                  "'" + tempatlahir.Text + "', " +
                  "'" + dateTimePicker1.Value.ToString("yyyyMMdd") + "', " +
                  "'" + jkel.SelectedItem + "'," +
                  "'" + alamat.Text + "', " +
                  "'" + kota.Text + "', " +
                  "'" + propinsi.SelectedItem + "' , " +
                  "'" + kodepos.Text + "', " +
                  "'" + telepon.Text + "', " +
                  "'" + hp.Text + "', " +
                  "'" + hobi.Text + "', " +
                  "'" + wali.Text + "', " +
                  "'" + alamatwali.Text + "', " +
                  "'" + telwali.Text + "', " +
                  " " + tahunmasuk.SelectedItem + ", " +
                  "  1 ) ";
            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Disimpan !!", "information");
                bersihkan();
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }
        void ComboBox1SelectedIndexChanged(object sender, EventArgs e)
        {
            sambung = new Koneksi();
            comboBox2.Items.Clear();
            comboBox2.Text = "";
            textBox2.Clear();
            kode_buku();
            sql = "SELECT nama from biodata_mahasiswa where stb = '" + comboBox1.SelectedItem + "' ";
            try{
                sambung.buka();
                query = new MySqlCommand(sql, sambung.koneksi);
                dr    = query.ExecuteReader();

                if (dr.Read())
                {
                    textBox1.Text = dr[0].ToString();
                }
                sambung.tutup();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
        }
Ejemplo n.º 28
0
        public DataTable cari_peminjaman(string cari)
        {
            sambung = new Koneksi();
            sql     = "Select peminjaman_buku.nomor_anggota, biodata_mahasiswa.nama,buku.kode_buku ,buku.judul, peminjaman_buku.tanggal_peminjaman " +
                      "From peminjaman_buku " +
                      "inner join biodata_mahasiswa on peminjaman_buku.nomor_anggota = biodata_mahasiswa.stb " +
                      "inner join buku on peminjaman_buku.kode_buku= buku.kode_buku " +
                      "where peminjaman_buku.nomor_anggota LIKE '%" + cari + "%' or biodata_mahasiswa.nama LIKE '%" + cari + "%' ";
            tabel = new DataTable();

            try {
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                adapter.Fill(tabel);
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
            return(tabel);
        }
Ejemplo n.º 29
0
        void SimpanClick(object sender, EventArgs e)
        {
            sambung = new Koneksi();

            sql = "INSERT INTO mahasiswa (stb, nama, alamat, nilai_tugas, nilai_mid, nilai_final, nilai_akhir, " +
                  "nilai_huruf, keterangan) " +
                  "VALUES ('" + stb.Text + "', '" + nama.Text + "', '" + alamat.Text + "', " + nt.Value + ", " + nm.Value + ", " + nf.Value + ", '" + na.Text + "', '" + nh.Text + "', " +
                  "'" + keterangan.Text + "')";

            try{
                sambung.buka();
                query   = new MySqlCommand(sql, sambung.koneksi);
                adapter = new MySqlDataAdapter(query);
                query.ExecuteNonQuery();
                MessageBox.Show("Data Berhasil Disimpan !!", "information");
                bersihkan();
                TampilDalamTable();
            } catch (Exception er) {
                MessageBox.Show(er.Message);
            }
            sambung.tutup();
        }