Forum Xamarin.Android

How to find last row in sql table through webservice

some1some1 Member ✭✭✭

i have created a webService . i want to find last row in sql server table . how can implement that in a controller . please help.

`[ResponseType(typeof(TH_ESTIMATE_ORDER_BILL))]

    public IHttpActionResult GetTH_ESTIMATE_ORDER_BILL(string id)
    {
        TH_ESTIMATE_ORDER_BILL tH_ESTIMATE_ORDER_BILL = db.TH_ESTIMATE_ORDER_BILL.Find(id);
        if (tH_ESTIMATE_ORDER_BILL == null)
        {
            return NotFound();
        }

        return Ok(tH_ESTIMATE_ORDER_BILL);
    }

`

this to find data corresponding to an id .

like wise i want o find last row in that table

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Use the following query code to get the last row.

    SELECT * FROM tablename ORDER BY column DESC LIMIT 1;
    
Sign In or Register to comment.