dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to retrieve first 3 records of first table and last 4 records of
second table, How to do this using c# and dataset?

Any suggestion would be greatly appretiated
 
if use to sql :

string Top3= "SELECT TOP 3 * FROM yuordatatable";
SqlDataAdapter YourComm = new SqlDataAdapter( Top3, yoursqlConn );
 
Hi,

First records:

dataset.Tables[ table1 ].Rows[0]
dataset.Tables[ table1 ].Rows[1]
dataset.Tables[ table1 ].Rows[2]

Last Records:
dataset.Tables[ table2 ].Rows[ dataset.Tables[ table2 ].Rows.Count-1]
dataset.Tables[ table2 ].Rows[ dataset.Tables[ table2 ].Rows.Count-2]
dataset.Tables[ table2 ].Rows[ dataset.Tables[ table2 ].Rows.Count-3]

Note you need to check if the tables have more than 2 records.

cheers,
 
Back
Top