odbc width access.mdb and a datagrid

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I'm new to prog in c# and i wanted to make a proggie that reads data
from an access db and i want the output to be displayed in a
datagrid..

How can this be done?

Thankz,
Peter
 
Peter said:
I'm new to prog in c# and i wanted to make a proggie that reads data
from an access db and i want the output to be displayed in a
datagrid..

Hi Peter,

You would use the OleDb data provider of ADO.NET. Here's a link with some
examples:

http://samples.gotdotnet.com/quickstart/howto/

Look under the"Data and ADO.NET" section. Each SqlXxx type has a
corresponding OleDbXxx type, so you can look in the .NET Framework BCL docs
to get the translation and more examples.

Joe
 
Create a new windows application
Goto Toolbox >> Data >> Drag OleDBDataAdapter
4.0>>Next >>Select Database File >>Test Connection >>Ok>>Next|>>Use SQL
Statement >>Query Builder>>Add Table >> Select Columns>>Ok>>NextPopulate Comes

Here is the code , use as Form load or under a button

oleDbDataAdapter1.Fill(dataSet1, "Employees");

dataGrid1.DataSource = dataSet1.Tables["Employees"].DefaultView;
 
Back
Top