private void btnGuardar_Click(object sender, EventArgs e) { var sql = $"insert into dbo.[tblUser] ( name, lastname, email, password) values('{txtNombre.Text}','{txtApellido.Text}','{ txtE_mail.Text }','{ txtContraseña.Text}')"; SqlCommand comando = new SqlCommand(sql, cn); comando.ExecuteNonQuery(); MessageBox.Show("Empleado ingresado con exito"); home form = new home(); form.Show(); }
private void btnIngresar_Click(object sender, EventArgs e) { var sql = $"select * from tblUser where email = '{txtUsuario.Text}'"; SqlCommand cmd = new SqlCommand(sql, cn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); Console.WriteLine(dt); if (dt.Rows[0][4].ToString() == txtContraseña.Text) { home form = new home(); form.Show(); } else { MessageBox.Show("contraseña incorrecta"); } }