![]() |
#2
yhlvht2014-06-22 22:42
|
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" && textBox2.Text == "")
{
MessageBox.Show("请输入用户名或密码,不能为空");
}
else
{
if (textBox1.Text != "" && textBox2.Text != "")
{
string str = ConfigurationManager.ConnectionStrings["kecheng"].ConnectionString;
SqlConnection con = new SqlConnection(str);
con.Open();
string strsql = "SELECT * FROM userssss";
SqlCommand com = new SqlCommand(strsql, con);
SqlDataReader red = com.ExecuteReader();
if (red.Read())
{
string name = red["username"].ToString();
string pad = red["passwd"].ToString();
int i = Convert.ToInt32(red["userpowsd"]);
if (textBox1.Text == name && textBox2.Text == pad)
{
if (i == 0)
{
admin f = new admin();
f.Show();
}
else
{
kaosheng kao = new kaosheng();
kao.Show();
}
}
else
{
MessageBox.Show("不存在该用户");
}
}
con.Close();
}
else
{
MessageBox.Show("不好意思,该用户不存在");
}
}
只有本站会员才能查看附件,请 登录