Query GUID type value from database
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was trying to query the SizeRecordId, its type value is GUID (check with SQL lite).
I was following this post: https://adndevblog.typepad.com/autocad/2012/12/plant-sdk-sample-of-pnptableselect.html
to use PnPTable.Select(). So far every type (string, double) is query successful but not the one with type GUID, in this case is SizeRecordId field.
So my code was like this:
PipePartSpecification pps = PipePartSpecification.OpenSpecification(spec_file);
PnPTable fittingsTable = pps.Database.Tables["EngineeringItems"];
string query = "\"SizeRecordId\"=X\'0C3BE84B27D5B447BCFC9EDFB4D9A09D\'";
PnPRow[] matchDtRows = fittingsTable.Select(query);
PnPRow[] matchDtRows = fittingsTable.Select(query);
when running P3D give me this error:
But the same query I was using will work in SQL Lite:
You can wonder why the real value is "4BE83B0C-D527-47B4-BCFC-9EDFB4D9A09D" but the query is different, this is the reason: https://stackoverflow.com/questions/7815587/using-guid-in-sqlite-select-where-guid-is-stored-in-the-...
For short explain you have to convert it to little endian before doing the query for GUID type value.
Really appreciate your guys help.
Autodesk Store for IntegaDesign Content
Smart Solutions by IntegaDesign
Plant 3D • CAD Optimization • Automation