コード例 #1
0
 public void CountUser()
 {
     try
     {
         conn.Open();
         SqlCommand cmd    = new SqlCommand("SELECT COUNT(*) FROM TAIKHOAN", conn);
         int        iCount = Convert.ToInt32(cmd.ExecuteScalar().ToString());
         if (iCount == 0)
         {
             System.Windows.MessageBox.Show("Mời bạn tạo 1 tài khoản trước khi đăng nhập", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
             AddAccountWindow newWindow = new AddAccountWindow();
             newWindow.ShowDialog();
         }
     }
     catch (SqlException ex)
     {
         System.Windows.MessageBox.Show(string.Concat("Error:" + ex.ToString()), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         this.Close();
     }
     conn.Close();
 }
コード例 #2
0
        private void TaoTaiKhoan_Click(object sender, RoutedEventArgs e)
        {
            AddAccountWindow NewWindow = new AddAccountWindow();

            NewWindow.Show();
        }