You are on page 1of 1

using using using using using using

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

namespace access { class Program { static void Main(string[] args) { string conString = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=C:\Documents and Settings\Rohit Chopra\My Documen ts\Northwind.mdb"; // create an open the connection OleDbConnection conn = new OleDbConnection(conString); conn.Open(); // create the DataSet DataSet ds = new DataSet(); // create the adapter and fill the DataSet OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from Customers", conn); adapter.Fill(ds); // close the connection conn.Close(); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { Console.WriteLine(dr["CompanyName"].ToString()); } Console.ReadLine(); } } }

You might also like