Click here to Skip to main content
15,915,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get the last row values from data set in datalist...
Posted

last row values from data set
// Assuming 1st table 

myDataset.Tables[0].Rows[myDataset.Tables[0].Rows.Count - 1]["ColumnNameForWhichValueNeeded"]
 
Share this answer
 
how to get the last row values from data set
I think it is datatable as dataset doesn't contain any rows directly.
This gives the last row of the datatable.

C#
datatable.Rows[datatable.Rows.Count - 1]


DataSet.Tables[0].Rows[DataSet.Tables[0].Rows.Count -1]
 
Share this answer
 
v2
//this way yo can get the Count Of rows 
 
 int LastRowNumber = Convert.ToInt32(ds.Tables[0].Rows.Count);

//if your Want the last row index (Suppose your LastRowNumber =6)
because indexStart From 0

int Id =  Convert.ToInt32(ds.Tables[0].Rows[5]["MyId"]);

//Another Way (Your Will get the Last Index Directly)

int LastRowNumber = Convert.ToInt32(ds.Tables[0].Rows.Count-1);

<pre>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900