Re: Retieve last record in the DB???
- From: "Josh" <s@xxxxx>
- Date: Thu, 2 Jun 2005 11:45:21 +0100
Assuming you have an Identity key on the table and the table is called
Town...
SELECT TOP 1 * FROM Town ORDER BY TownID DESC
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:E3FAFFFA-CBD1-499B-9EA8-C31DDEA80C85@xxxxxxxxxxxxxxxx
> Simple question...
>
> I want to retrive the last record in the database if the value of id is
> nothing!
>
> Can someone please help!
>
> Thanks
>
> ...CODE...
> Dim objImpCnt As SqlParameter
> If objImpCnt Is Nothing Then
> objImpCnt = cmd.Parameters.Add("@newsID", SqlDbType.Int)
> objImpCnt.Direction = ParameterDirection.Input
> objImpCnt.Value = id
> Else
> objImpCnt.Value = 'Last Record in the db
> End If
.
- References:
- Retieve last record in the DB???
- From: Tim::..
- Retieve last record in the DB???
- Prev by Date: Re: REGDB_E_CLASSNOTREG(0x80040154)
- Next by Date: Re: Using objects to print pdf report?
- Previous by thread: RE: Retieve last record in the DB???
- Next by thread: HTTP 401.3 - Access denied by ACL on resource
- Index(es):