示例#1
0
 void Button1Click(object sender, EventArgs e)
 {
     try {
         string           usr      = usrName.Text.ToString();
         string           psw      = psWord.Text.ToString();
         string           id_usr   = "";
         string           nm_usr   = "";
         string           username = "";
         string           koneksi  = "server=localhost;database=db_penginapan;uid=root;password="******"select * from tbl_user where username='******' and password='******'", koneksiB);
         MySqlDataAdapter adap     = new MySqlDataAdapter(com);
         DataTable        table    = new DataTable();
         adap.Fill(table);
         koneksiB.Open();
         foreach (DataRow kolom in table.Rows)
         {
             id_usr   = kolom["id_user"].ToString();
             nm_usr   = kolom["nama_lengkap"].ToString();
             username = kolom["username"].ToString();
         }
         if (table.Rows.Count > 0)
         {
             FrmPenginapan f1 = new FrmPenginapan();
             f1.id_user  = id_usr;
             f1.namaUser = nm_usr;
             f1.userName = username;
             f1.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Uppppzzzz...!!!!\nPassword dan Username salah....!!!!", "Terjadi Error Coy...!!!!");
         }
         koneksiB.Close();
     } catch (Exception err) {
         MessageBox.Show(err.ToString());
     }
 }
示例#2
0
文件: MainForm.cs 项目: codebe/sim-rs
 void Button1Click(object sender, EventArgs e)
 {
     try {
             string usr = usrName.Text.ToString();
             string psw = psWord.Text.ToString();
             string id_usr = "";
             string nm_usr = "";
             string username = "";
             string koneksi = "server=localhost;database=db_penginapan;uid=root;password="******"select * from tbl_user where username='******' and password='******'",koneksiB);
             MySqlDataAdapter adap = new MySqlDataAdapter(com);
             DataTable table = new DataTable();
             adap.Fill(table);
             koneksiB.Open();
             foreach(DataRow kolom in table.Rows)
             {
                 id_usr = kolom["id_user"].ToString();
                 nm_usr = kolom["nama_lengkap"].ToString();
                 username = kolom["username"].ToString();
             }
             if (table.Rows.Count>0)
             {
                 FrmPenginapan f1 = new FrmPenginapan();
                 f1.id_user = id_usr;
                 f1.namaUser = nm_usr;
                 f1.userName = username;
                 f1.Show();
                 this.Hide();
             }
             else{
                 MessageBox.Show("Uppppzzzz...!!!!\nPassword dan Username salah....!!!!","Terjadi Error Coy...!!!!");
             }
             koneksiB.Close();
             } catch (Exception err) {
                 MessageBox.Show(err.ToString());
             }
 }