简单的C#用户权限管理系统

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace 用户权限管理{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnExit_Click(object sender, EventArgs e) { this.Dispose(); } private void btnLogin_Click(object sender, EventArgs e) { string strLogin = txtLogin.Text.Trim(); string strPass = txtPass.Text.Trim(); string str = "select * from Login where Login='"+strLogin+"'and Login_pwd='" +strPass+"'"; DataOperater oper = new DataOperater(); OleDbDataReader oda = oper.sql_oper(str).ExecuteReader(); oda.Read(); if (oda.HasRows) { string str1 = "select Power from Login where Login='" + strLogin + "'and Login_pwd='" + strPass + "'"; Form2 frm = new Form2(); frm.strPower=oper.sql_dataset(str1).Tables[0].Rows[0][0].ToString(); this.Hide(); frm.ShowDialog(); this.Dispose(); } else { txtLogin.Text = ""; txtPass.Text = ""; MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void txtLogin_TextChanged(object sender, EventArgs e) { } }}

你可能感兴趣的:(C#)