private void User_Login(object sender, RoutedEventArgs e) { ///查询Username && Password 是否存在记录在表User ///是则Close > WPF_Main ///否则提示错误 /// string sql = "select * from User where Username ='******' and Password='******'"; DataSet ds = MySQLHelper.GetDataSet(MySQLHelper.GetConn(), CommandType.Text, sql, null); if (!((ds == null) || (ds.Tables.Count == 0) || (ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))) { MessageBox.Show("登录成功!"); this.Close(); WPF_Main main = new WPF_Main(); main.Show(); } else { MessageBox.Show("登录失败"); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { WPF_Main wpf_main = new WPF_Main(); wpf_main.ShowDialog(); }