G
Guest
Hi
How to read the LAST record of datareader? Here is my code
[code
StringBuilder objBuilder = new StringBuilder()
objBuilder.Append("SELECT startdate, enddate FROM records where userid = '")
objBuilder.Append(id)
objBuilder.Append("'")
SqlDataReader dr = null
int RecordCount = 0
tr
dr = SqlHelper.ExecuteReader(DBConnection.ConnString, CommandType.Text, objBuilder.ToString())
while (dr.Read()
RecordCount++
if(dr.) // how to read the LAST record of the selected rows
this.StartDate = Convert.ToDateTime(dr["startdate"])
this.EndDate = Convert.ToDateTime(dr["enddate"])
[/code
I know how to count the total number of row. But, I only need the last row of data. dr.Read() gets the first row only. How can I do it
Thanks for hel
How to read the LAST record of datareader? Here is my code
[code
StringBuilder objBuilder = new StringBuilder()
objBuilder.Append("SELECT startdate, enddate FROM records where userid = '")
objBuilder.Append(id)
objBuilder.Append("'")
SqlDataReader dr = null
int RecordCount = 0
tr
dr = SqlHelper.ExecuteReader(DBConnection.ConnString, CommandType.Text, objBuilder.ToString())
while (dr.Read()
RecordCount++
if(dr.) // how to read the LAST record of the selected rows
this.StartDate = Convert.ToDateTime(dr["startdate"])
this.EndDate = Convert.ToDateTime(dr["enddate"])
[/code
I know how to count the total number of row. But, I only need the last row of data. dr.Read() gets the first row only. How can I do it
Thanks for hel