c#读access数据库

时间:2015-04-22 11:00:08   收藏:0   阅读:227

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

 

原文:http://www.cnblogs.com/vivicai/p/4446634.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!