TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Peter Dzuya
NA
313
40.7k
Getting an Identity of the most recent added record
Jun 30 2016 4:28 AM
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.
Reply
Answers (
4
)
InstallShield Installation
add two Binary number