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

1 posts, 0 answers
  1. Anand
    Anand avatar
    1 posts
    Member since:
    Aug 2012

    Posted 25 Aug 2012 Link to this post

    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 ..

Back to Top