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("\t{0}\t{1}", thisReader[0], thisReader[1]);
}

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


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

 

posted on 2015-04-22 10:25  vivicai  阅读(298)  评论(0)    收藏  举报