Tuesday, September 21, 2010

LinQ2SQL GUID

This example shows how to compare/filter GUID or UniqueIdentifier types  on Linq2SQL:

String guid = "5236DFEC-A4DB-40B5-B873-F2468697B282";
Guid filterGuid = new Guid(guid);

var matchDB = (from c in db.FormsSubmissions
                         where
                              c.GuidColumn.Equals(filterGuid)
                          select c).First();

No comments:

Post a Comment