Home

OData Service V3.

I am able to connect to a ODATA Source and do selects on the table.
How can I use Linqpad to update the record in the table?

I don't believe this is a permissions issue as I am able to update the table from my C# console based application.

Here is a code snippet that works in VS 2012.
var uri = new Uri("http://localhost:50741/QuoteContactODataService.svc", UriKind.Absolute);
var qcs = new Q2Dev2Entities(uri);
var qc2 = qcs.QuoteContacts.Where(a => a.contact_fname == "" && a.contact_type == "C");

            
            foreach (var qc in qc2)
            {
                qc.contact_fname = "N/A";
                qc.contact_email = "na@na.com";
                qc.last_update_date = DateTime.Now;
                qc.last_updated_by = "svc_OdataClient";
                qcs.UpdateObject(qc);
            }
             
            qcs.SaveChanges();
If I run this code as C# program it works.
How can I run it as a C# statement and get Linqpad to update the record?
Sign In or Register to comment.