OdbcConnection for Access mdb file
using System;
using Microsoft.Data.Odbc;
class MainClass
{
static void Main(string[] args)
{
string connectionString = @"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\Northwind.mdb";
string SQL = "SELECT * FROM Orders";
OdbcConnection conn = new OdbcConnection(connectionString);
OdbcCommand cmd = new OdbcCommand(SQL);
cmd.Connection = conn;
conn.Open();
OdbcDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.Write("OrderID:"+reader.GetInt32(0).ToString() );
Console.Write(" ,");
Console.WriteLine("Customer:" + reader.GetString(1).ToString() );
}
reader.Close();
conn.Close();
}
}
|
HTML code for linking to this page:
Related in same category :
-
|