c#读access数据库

using System;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;

class Program
{
static void Main(string[] args)
{
OleDbConnection thisConnection = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\cinda_dafen_simple.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT * FROM 采购项目招标信息表";
OleDbDataReader thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
Console.WriteLine(" {0} {1}", thisReader[0], thisReader[1]);
}

while (thisReader.Read())
{
DataRow row = thisReader.Read();
foreach(row.)
}


thisReader.Close();
thisConnection.Close();
Console.WriteLine("数据库读取完成!");
Console.ReadLine();
}
}

原文地址:https://www.cnblogs.com/vivicai/p/4446634.html