Wednesday

datacontext linq refresh example C# - linq example how to save object in linq to sql


public string SaveInvoiceXML(string sInvoice){
try{
Invoice inv = new Invoice();
inv = CXMLConv.fromXML<Invoice>(sInvoice, inv);

LinqDataObjectsDataContext dc = new LinqDataObjectsDataContext();

dc.Invoices.Attach(inv);
dc.Refresh(RefreshMode.KeepCurrentValues, inv);
dc.SubmitChanges();

return OK(CXMLConv.toXML(inv));
}
catch (Exception ex)
{
return RegisterError(ex, "SaveInvoiceXML", sInvoice);
}
}


more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...