单步调试过,都有值,但是就是会报错,求大神帮忙看看
private void button_Login_Click(object sender, EventArgs e)
{
if(!pdyj())
{
MessageBox.Show("请输入正确信息!");
return;
}
string ConnectionWords = @"provider = Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\回原点运动\回原点运动\login.mdb";
OleDbConnection MyAccessConnect = new OleDbConnection(ConnectionWords);
MyAccessConnect.Open();
string CommandString = "select * from Login where 用户名称 = '"+ this.textBox1.Text +"'and 用户密码 ='&"+ this.textBox2.Text +"'and 用户类型 ='"+ this.comboBox1.Text +"'";
OleDbCommand cmd = new OleDbCommand(CommandString, MyAccessConnect);
OleDbDataReader ReadMyaccess = cmd.ExecuteReader();
MyAccessConnect.Close();
if (ReadMyaccess.Read())
{
usname = textBox1.Text;
uspass = textBox2.Text;
uslevel = comboBox1.Text;
MessageBox.Show("登录成功!");
Form6 fm = new Form6();
this.Hide();
fm.Show();
this.Dispose();
}
else
{
MessageBox.Show("连接失败!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}