Exemplo n.º 1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string strname = textBox_id.Text.Trim();
            string strpwd  = passwordBox1.Password.Trim();
            MySqlConnectionStringBuilder s = new MySqlConnectionStringBuilder();

            s.Server   = "localhost";
            s.Port     = 3306; //mysql端口号
            s.Database = "db_jiaowu";
            s.UserID   = "root";
            s.Password = "******";
            MySqlConnection  conn      = new MySqlConnection(s.ConnectionString);
            string           strselect = "select * from user_stu where user_stu='" + strname + "'and stu_pwd='" + strpwd + "' ";
            MySqlDataAdapter adapter   = new MySqlDataAdapter(strselect, conn);
            DataSet          ds        = new DataSet();

            adapter.Fill(ds);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("登录成功");
                info frmobj = new info();
                frmobj.Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }
        }
Exemplo n.º 2
0
        private void stu1_Click(object sender, RoutedEventArgs e)
        {
            info frmobj = new info();

            frmobj.Show();
        }