private void LoginButton_Click(object sender, RoutedEventArgs e) { InitializeComponent(); string Login = LoginText.Text; string Pass = PassText.Text; SqlConnection connection = new SqlConnection("Data Source=DRDI;Initial Catalog=wpf_sql;Integrated Security=True;"); DB db = new DB(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(); db.openConn(); SqlCommand command = new SqlCommand("SELECT * FROM users WHERE login = @LU AND pass = @LP", connection); command.Parameters.Add("@LU", System.Data.SqlDbType.VarChar).Value = Login; command.Parameters.Add("@LP", System.Data.SqlDbType.VarChar).Value = Pass; adapter.SelectCommand = command; adapter.Fill(table); if (table.Rows.Count > 0) { MessageBox.Show("вход выполнен"); GeneralWin generalWin = new GeneralWin(); generalWin.Show(); db.closeConn(); this.Close(); } else { MessageBox.Show("вход не выполнен"); } }
public ChangeWin(GeneralWin parent) { InitializeComponent(); this.parent = parent; }