Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
4
Reply
Getting an Identity of the most recent added record
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Peter Dzuya
8 years ago
269
1
Reply
Hi All,
I have a code as detailed below which is used to insert a record in one table. However, I need the primary key of the added record and use it elsewhere.
_invoice.Datecreated = DateTime.Now;
_invoice.CustomerInvoiceStatus = CustomerInvoiceStatus.Confirmed;
_invoice.InvoiceTotal = selectedGatePassDespatch.TotalValue;
_invoice.InvoiceReceiptTotal = selectedGatePassDespatch.TotalValue;
_invoice.InvoiceBalance = selectedGatePassDespatch.TotalValue;
_invoice.VatRate = selectedVatRate.Percentage;
_invoice.Posted = true;
_invoice.CustomerContactRelationId = selectedGatePassDespatch.CustomerContact.ContactId;
_invoice.ChartAccountId = selectedStockItem.ChartAccountId;
InvoicebindingSource.EndEdit();
_invoiceService.Insert(_invoice);
So How do I get it Please.
Thanks.
Peter.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
InstallShield Installation
add two Binary number