Hi
How to read the LAST record of datareader? Here is my code
[code
StringBuilder objBuilder = new StringBuilder()
objBuilder.Appe nd("SELECT startdate, enddate FROM records where userid = '")
objBuilder.Appe nd(id)
objBuilder.Appe nd("'")
SqlDataReader dr = null
int RecordCount = 0
tr
dr = SqlHelper.Execu teReader(DBConn ection.ConnStri ng, CommandType.Tex t, objBuilder.ToSt ring())
while (dr.Read()
RecordCount++
if(dr.) // how to read the LAST record of the selected rows
this.StartDate = Convert.ToDateT ime(dr["startdate"])
this.EndDate = Convert.ToDateT ime(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.Appe nd("SELECT startdate, enddate FROM records where userid = '")
objBuilder.Appe nd(id)
objBuilder.Appe nd("'")
SqlDataReader dr = null
int RecordCount = 0
tr
dr = SqlHelper.Execu teReader(DBConn ection.ConnStri ng, CommandType.Tex t, objBuilder.ToSt ring())
while (dr.Read()
RecordCount++
if(dr.) // how to read the LAST record of the selected rows
this.StartDate = Convert.ToDateT ime(dr["startdate"])
this.EndDate = Convert.ToDateT ime(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
Comment