这是MainWondow.xaml中部分代码:[<Button    Foreground="Black" Background="Transparent"   BorderBrush="Transparent"  Content=">> "
                               Margin="378,178,-6,-220" Click="CheckUser" RenderTransformOrigin="0.906,0.438" >]
这是MainWindow.xaml.cs中部分代码: private void CheckUser(object sender, RoutedEventArgs e)
        {
           mainDal check = new mainDal(); 
            if (teacher.IsChecked.Equals(true))
            {                if (check.Login(this.username.Text, this.password.Text, "teacher"))
                {
                    adminBoard a = new adminBoard();
                    name = this.username.Text;
                    a.Name1 = name;
                    a.Show();
                    stdEnd.Begin();
                }
                else
                    MessageBox.Show("Invalid Password");
            }
            else if (student.IsChecked.Equals(true))
            {
                if (check.Login(this.username.Text, this.password.Text, "student"))
                {
                    studentBoard s = new studentBoard();
                    s.Name1 = this.username.Text;
                    s.Show();
                    stdEnd.Begin();
                }
                else
                    MessageBox.Show("Invalid Password");
            }
        }这是mainDal()函数:
public class mainDal
    {
        string path = @"Data Source=(LocalDB)\v11.0; AttachDbFilename=C:\Teacher-Student-Portal-a-WPF-Application-master\Dal\tsFacility.mdf;Integrated Security=True";
        SqlConnection con;
        public void makeConnection()
        {
            con = new SqlConnection(path);
            con.Open();
        }
}