Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataTable Select() with Guids

I am trying to boild my treeview at runtime from a DataTable that is returned from a LINQ query. The Fields returned are:

NAME = CaseNoteID | ContactDate | ParentNote TYPE = Guid | DateTime | Guid

The ParentNote field matches a entry in the CaseNoteID column. The Select(filter) is giving me a runtime error of Cannot find column [ea8428e4]. That alphanumeric is the first section of one of the Guids. When I step thru my code filter = "ParentNote=ea8428e4-1274-42e8-a31c-f57dc2f189a4"

What am I missing?

var tmpCNoteID = dr["CaseNoteID"].ToString();
                var filter = "ParentNote="+tmpCNoteID;

                DataRow[] childRows = cNoteDT.Select(filter);
like image 255
Refracted Paladin Avatar asked Apr 17 '26 07:04

Refracted Paladin


1 Answers

Try enclosing the GUID with single quotes:

var filter = "ParentNote='"+tmpCNoteID+"'";