using System; using System.Data.OleDb; namespace ConsoleApplication { class Program { static void Main(string[] args) { string strConnection = "Provider = Microsoft.ACE.OLEDB.12.0;"; strConnection += @"Data Source = c:/Database1.accdb "; OleDbConnection con = new OleDbConnection(strConnection); con.Open(); OleDbCommand com = con.CreateCommand(); com.CommandText = "SELECT * FROM 表1"; OleDbDataReader reader = com.ExecuteReader(); while (reader.Read()) { Console.WriteLine((string)reader["姓名"]+" "+(int)reader["年齡"]+" "+(string)reader["性別"]); } reader.Close(); con.Close(); Console.Read(); } } }