using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
OleDbConnection accConnection = new OleDbConnection();
OleDbCommand accCommand = new OleDbCommand();
DataSet ds = new DataSet();
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\DataBase\\xxx.mdb";
string cmdString = "SELECT * FROM info";
accConnection = new OleDbConnection(connString);
accConnection.Open();
accCommand.Connection = accConnection;
accCommand.CommandType = CommandType.Text;
accCommand.CommandText = cmdString;
dataAdapter.SelectCommand = accCommand;
dataAdapter.Fill(ds, "xxx");
var logininfo = (from li in ds.Tables["xxx"].AsEnumerable() select li );
foreach (var fRow in logininfo)
{
Console.WriteLine("no: {0} name: {1}",
fRow.Field<string>("no"), fRow.Field<string>("name"));
}
accConnection.Close();
}
}
}