using System.Data.OleDb;
DataSet ds = new DataSet();
OleDbCommand comm = new OleDbCommand();
OleDbDataAdapter da = new OleDbDataAdapter();
//access数据库连接字符串,自行更改数据库路径和名字
string ConnectionStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + @"\EquipmentDB.mdb;Persist Security Info=False";
OleDbConnection conn = new OleDbConnection(ConnectionStr);
conn.Open();
comm.Connection = conn;
comm.CommandType = CommandType.Text;
comm.CommandText = "select * from DictOper";//查询DictOper表
da.SelectCommand = comm;
da.Fill(ds);
textBox1.Text=ds.Tables[0].Rows[0][0].ToString();//显示第一行第一列的一个值
conn.Close();