当前位置:Gxlcms > 数据库问题 > 【C#学习笔记】读access2007

【C#学习笔记】读access2007

时间:2021-07-01 10:21:17 帮助过:20人阅读

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(); } } }

 

【C#学习笔记】读access2007

标签:.exe   ndt   and   ext   text   exec   tab   rom   sel   

人气教程排行