示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         SqlConnection sqlcon = new SqlConnection(@"Data Source=MSI;Initial Catalog=cajero;User ID=team;Password=12345");
         SqlCommand    cmd    = new SqlCommand("_login @userci,@pwd", sqlcon);
         cmd.Parameters.AddWithValue("@userci", txtUser.Text);
         cmd.Parameters.AddWithValue("@pwd", txtPassword.Text);
         SqlDataAdapter sda  = new SqlDataAdapter(cmd);
         DataTable      dtbl = new DataTable();
         sda.Fill(dtbl);
         sqlcon.Open();
         int i = cmd.ExecuteNonQuery();
         sqlcon.Close();
         if (dtbl.Rows.Count == 1)
         {
             Opciones opc = new Opciones();
             opc.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("verifica tu usuario o contraseña");
         }
     } catch (Exception error)
     {
         MessageBox.Show("Error: " + error, "", MessageBoxButtons.OK);
     }
 }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Opciones opc = new Opciones();

            opc.Show();
            this.Hide();
        }