How to fetch the last inserted record in a particular table?

Answer Posted / raji22559

CommanObject.CommandText="Select @@Identity";

** Note: Over a given connection if any insert statement is
executed on a table with identity column , the back end
sql-server for the connection initializes a parameter by
name "@@Identity" with the value of Identity column for the
last inserted record.

Is This Answer Correct ?    18 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ado.net architecture?

485


What are datareaders?

525


Is bulk insert faster than insert?

488


What is acid in ado.net?

525


How to copy the contents from one table to another table and how to delete the source table in ado.net?

518






What is ado.net explain with diagram?

508


What are the data providers in ADO.NET framework?

588


Explain the differences between oledb sql server, oledbdotnet provider?

550


What does executequery return?

514


What is ado.net and its architecture?

497


What is difference between ado.net and asp net?

509


Define different execute methods of ADO.NET command object ?

545


What is ado and dao?

529


Explain ado.net features? Benefits? Drawbacks?

545


What is command class in ado.net?

472