void Main() { var students = Students.Where(st => st.Photo != null).Select(st => new { st.Id, st.Photo }); foreach (var student in students) { File.WriteAllBytes(@"D:\Photos\" + student.Id + ".jpg", student.Photo.ToArray()); } }
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Tuesday, July 19, 2016
Export binary data from database using LINQPAD
Switch LinqPad to c# Program
LINQ to Entities does not recognize the method 'System.String PadLeft(Int32)'
Convert to list then do padleft
The entity type List`1 is not part of the model for the current context
where db is List
so use a loop instead
db.Entry(bd).State = EntityState.Modified;
DbContext.Entry(object) expects a single object, not a collection.
so use a loop instead
foreach (var item in bd) { db.Entry(item).State = EntityState.Modified; }
Subscribe to:
Comments (Atom)