print last row in datagrid from table?

Posted by Hariinakoti under C# on 4/13/2012 | Points: 10 | Views : 1457 | Status : [Member] | Replies : 13
hi,

i need to print the last row of the table in the data grid form .i am using the sql server and c#.net.. i want to print the recently inserted row of the table.. can u tell me the answer..

Thanks & Regards
Hari



Responses

Posted by: Self-Innovator on: 4/13/2012 [Member] Bronze | Points: 25

Up
0
Down
Select TOP 1 * from tbUserMst order by 'ActNoId' desc

tbUserMst-tablename
ActNoId-ColumnName

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
@Self inovator
i got error at this query

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/13/2012 [Member] Bronze | Points: 25

Up
0
Down
WILL U SPECIFY THE ERROR....Post your Query

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
select top1 * from sales orderby 'Itemcode' desc

I got error at top1 and if i remove top1 next error at column name.

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/13/2012 [Member] Bronze | Points: 25

Up
0
Down
make sure u've given space betwwen TOP & 1 not like TOP1

select top 1 * from sales orderby 'Itemcode' desc


Join Hands Change lives
Thanks & Regards
Straight Edge Society

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Ok,Thanq .
But i entered some values in the table itz displayed but not last record..

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/13/2012 [Member] Bronze | Points: 25

Up
0
Down
It wil disp try..

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
itz not display dude..only highest value only displayed.

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sridevi on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Try this


Select * from tname order by tno desc limit 1;

tname -> table name
tno -> column

Regards,

Sridevi.

Sridevi

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sridevi on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Sorry don't follow the above query its not working


Sridevi

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/14/2012 [Member] Starter | Points: 25

Up
0
Down
@sridevi
ok,thanq.if u know plz solve my problem

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Somasundaram on: 4/14/2012 [Member] Starter | Points: 25

Up
0
Down
try by using max() function

Hope you can find solution in this..



Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/15/2012 [Member] Starter | Points: 25

Up
0
Down
plz tell me that query

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response