高手帮下忙啊,我要做毕业实际啊!
using System;
using System.Collections.Generic;
namespace 学生管理系统
{
public partial class Frm_登陆界面 : Form
{
public Frm_登陆界面()
{
InitializeComponent();
skinEngine1.SkinFile = "SteelBlue.ssk";
}
private void btnCancel_Click_1(object sender, EventArgs e)
{
DialogResult result;
result = MessageBox.Show("确定要退出吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
Application.Exit();
}
private void btnLogin_Click(object sender, EventArgs e)
{
Frm_主界面 Fm = new Frm_主界面();
MyData mydata = new MyData();
string s = "select * from [user] where usrno='" + this.txtusername.Text + "' and usrpwd ='" + this.txtstuPSW.Text + "'and ustype='" + comboBox1.Text + "'";
SqlDataReader dr = mydata.getDataReader(s);
if (txtusername.Text == "")
{
MessageBox.Show("请输入您的用户名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (txtstuPSW.Text == "")
{
MessageBox.Show("请输入密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (comboBox1.Text == "")
{
MessageBox.Show("请选择您的身份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (dr.HasRows)
{
while (dr.Read())
{
string strusername = dr["usrno"].ToString().Trim();
string username = this.txtusername.Text;
string comtype = dr["ustype"].ToString().Trim();
if (username == strusername)
{
string stuPSW = dr["usrpwd"].ToString().Trim();
string psw = this.txtstuPSW.Text;
if (stuPSW == psw)
{
if (comtype == this.comboBox1.Text)
{
Fm.UserName = strusername;
Fm.PassWord = stuPSW;
Fm.UserType = comtype;
Fm.Show();
txtusername.Text = "";
txtstuPSW.Text = "";
comboBox1.Text = "";
this.Hide();
}
}
}
}
}
else
{
MessageBox.Show("对不起,你的密码、用户名或身份错误!\n 请重新输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtusername.Text = "";
txtstuPSW.Text = "";
comboBox1.Text = "";
txtusername.Focus();
}
mydata.closeConnection();
}
大家帮我看看这段代码哪儿错了