i have a table name "AddFIR" , i want that when i click the button to save the record, "FIRid" Will be show on that time. e.g; "Your FIR Was Successfully Saved And Your FIR ID IS : 55" ,
anyone help me how i resolve this method?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prateek SinglaPosted Nov 21, 2016, 1:47 AM
Entity Framework will automatically load the last inserted id to populate the primary key column of the inserted entity:
Note that the
Idproperty only gets populated after callingSaveChanges()in case theStoreGeneratedPatternattribute is set to "Identity" or "Computed" for the auto-incremented ID column in the Storage part of the model.Manas MohapatraPosted Nov 21, 2016, 1:46 AM
Bilawal NiazPosted Nov 20, 2016, 9:19 PM
Manas MohapatraPosted Nov 20, 2016, 1:18 PM