public void SubmitButton(object param) { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\User\source\repos\VIAApp2Demo\VIAApp2Demo\DB\DatabaseStudents.mdf;Integrated Security=True;Connect Timeout=30"); try { if (conn.State == System.Data.ConnectionState.Closed) conn.Open(); String query = "SELECT COUNT (*) FROM Login where pwd=@pwd"; SqlCommand cmd = new SqlCommand(query, conn); cmd.CommandType = CommandType.Text; SqlParameter Pwd = cmd.Parameters.AddWithValue("@pwd", SqlDbType.Int); //cmd.Parameters["@pwd"].Value = _pwd.pwd; cmd.Parameters["@pwd"].Value = TestPassword; if (Pwd.Value == null) { Pwd.Value = DBNull.Value; } int count = Convert.ToInt32(cmd.ExecuteScalar()); if (count > 0) { MainWindow main = new MainWindow(); main.Show(); } else { MessageBox.Show("Password is incorrect!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } }
PropertyChanged
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)