namespace Database
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class Access
{
private System.Data.OleDb.OleDbConnection conn;
private System.Data.OleDb.OleDbCommand cmd;
private System.Data.OleDb.OleDbDataReader dr; public Access()
{
conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\ATM\user.mdb";
} private bool Open()
{
try
{
this.conn.Open();

}
catch (Exception ex)
{
return false;
}
return true;
} private void Close()
{
this.conn.Close();
}

public bool search(string str)
{
this.cmd = new System.Data.OleDb.OleDbCommand("select * from User where accountMoney > 2000" ,this.conn);
this.conn.Open();
this.dr = this.cmd.ExecuteReader(); //此句报错

if (this.dr == null)
{
conn.Close();
return false;
}
conn.Close();
return true;
}
}
}错误消息 : 未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
为什么呢?书上确实是这么写的,怎么改,麻烦指点下