if (users.Text.Trim().Length > 0 && password.Text.Trim().Length > 0) 

base.Cursor = Cursors.WaitCursor; 
//从mysql数据库读取数据进行比对 
MySQLConnection DBConn; 
DBConn = new MySQLConnection(new MySQLConnectionString("localhost", "mybase", "root", "tizheng", 3306).AsString); 
DBConn.Open(); 
// MySQLCommand conn = new MySQLCommand("set names gb2312", DBConn); 
// conn.ExecuteNonQuery(); 
MySQLCommand cmd = new MySQLCommand("select count(*) from login where Users='" + users.Text + "' and Pwd='" + password.Text + "'", DBConn); 
int flag = Convert.ToInt32(cmd.ExecuteScalar()); //数据读取标记,传递用户权限 
if (flag > 1) 

cmd = new MySQLCommand("seclect * from login Users='" + users.Text + "'", DBConn); 
MySQLDataReader sdr = (MySQLDriverCS.MySQLDataReader)cmd.ExecuteReader(); 
sdr.Read(); 
string Users_Type = sdr["power"].ToString().Trim(); //不知道个地方怎么进行登陆的权限的传递,初学不是很懂,怎么传个mainFrom这个窗口啊
DBConn.Close(); 
this.DialogResult = DialogResult.OK; 
this.Close(); 

else { 
this.DialogResult = DialogResult.No; 
MessageBox.Show("账号或密码不正确,请重新输入!", "登陆错误!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); 
} } 
else 

MessageBox.Show("账户名或密码不能为空!", "登陆错误!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); 
DialogResult = DialogResult.None; 

数据库字段方面肯定没错 
不知道为什么不进flag,一直提示的都是密码账户错误