示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Formularios frm = new Formularios();

            frm.ShowDialog();
            this.Hide();
        }
示例#2
0
 private void Btn_Login_Click(object sender, EventArgs e)
 {
     if (Txt_Ruc.Text.Trim() == "" && Txt_Pass.Text.Trim() == "")
     {
         MessageBox.Show("Los campos están vacíos", "Error");
     }
     else
     {
         string           query = "SELECT * FROM Usuarios WHERE Ruc=@ruc AND password=@pass";
         SQLiteConnection conn  = new SQLiteConnection("Data Source=Login.db; Version=3;");
         conn.Open();
         SQLiteCommand cmd = new SQLiteCommand(query, conn);
         cmd.Parameters.AddWithValue("@ruc", Txt_Ruc.Text);
         cmd.Parameters.AddWithValue("@pass", Txt_Pass.Text);
         SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
         DataTable         dt = new DataTable();
         da.Fill(dt);
         if (dt.Rows.Count > 0)
         {
             MessageBox.Show("Usted ha ingresado correctamente", "Loggeo Exitoso");
             Formularios frm = new Formularios();
             frm.ShowDialog();
             conn.Close();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Usuario o contraseña incorrecto", "Error");
         }
     }
 }