Sample Code for Forward, and Backward movement

  • Thread starter Thread starter Byron Hopp
  • Start date Start date
B

Byron Hopp

Could someone lead me to some simple code where I can select data from an
access table via ado.net and display it in a grid for forward, and backward
movement?

Byron...
 
The grid will sort it by clicking on the top column header (assuming you are
using a Winform Grid). You can reference any row in the underlying
datatable by using its row index

foreach(DataRow dro in myTable.Rows){

//Do whatever here

}

You can use the BindingManager or BindingContext as well (search on Google,
tons of examples) to navigate via the grid itself.

HTH,

Bill
 
Thanks for William's reply.

Byron, the following codes connect to an Access (.mdb) file and fill a
DataSet with a table. The table will be displayed in a DataGrid.

OleDbConnection cnn = new OleDbConnection("Data
Source=northwind.mdb;Password=;Provider=Microsoft.Jet.OLEDB.4.0;");
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Products",
cnn);
DataSet ds = new DataSet();
da.Fill(ds,"Products");
this.dataGrid1.DataSource = ds.Tables("Products");

Like what William said, the grid will sort it by clicking on the top column
header in a Windows Form.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "William Ryan" <[email protected]>
| References: <[email protected]>
| Subject: Re: Sample Code for Forward, and Backward movement
| Date: Sun, 14 Sep 2003 12:06:12 -0400
| Lines: 28
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <ul#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 68.47.116.114
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:61135
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| The grid will sort it by clicking on the top column header (assuming you
are
| using a Winform Grid). You can reference any row in the underlying
| datatable by using its row index
|
| foreach(DataRow dro in myTable.Rows){
|
| //Do whatever here
|
| }
|
| You can use the BindingManager or BindingContext as well (search on
Google,
| tons of examples) to navigate via the grid itself.
|
| HTH,
|
| Bill
| | > Could someone lead me to some simple code where I can select data from
an
| > access table via ado.net and display it in a grid for forward, and
| backward
| > movement?
| >
| > Byron...
| >
| >
|
|
|
 
Back
Top