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 38 Views
Chart
This is a migrated thread and some comments may be shown as answers.
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 ..

No answers yet. Maybe you can help?

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