This is a migrated thread and some comments may be shown as answers.

How Can i get primary key value when insert data to table?

0 Answers 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anand
Top achievements
Rank 1
Anand asked on 25 Aug 2012, 09:55 AM

Hi,

I have a table named as House in my database.which has 3 columns as HouseId(Primarykey),HouseDate,HouseType.

In my view model I have insert method as follows

 _stx = new CPMDomainContext();            House.HouseDate = HouseDate;            House.HouseType = HouseType;            _stx.Houses.Add(House);            _stx.SubmitChanges();

Data added to table successfully.Now how can i get HouseId of newly added data.

Help me ..

Tags
Chart
Asked by
Anand
Top achievements
Rank 1
Share this question
or