| 10/31/2006 2:25:37 PM |
Hi
I have an opath query as show below. How would i parameterise it please?
OPath query query = new OPathQuery(typeof(SettingValue), " FormatList.FormatID = '" + formatID + "' && SettingID='" + settingID + "'");
many thanks
anndrea |
| 11/2/2006 9:33:39 AM |
Just replace each variable in your query with a question mark, like so:
OPathQuery query = new OPathQuery(typeof(SettingValue), "FormatList.FormatID = ? && SettingID = ?);
Then pass the values when you execute the query:
ObjectSet results = WormEngine.GetObjectSet(formatID, settingID);
- Jeff Lanning |
| 11/8/2006 10:38:10 AM |
OPathQuery query = new OPathQuery(typeof(SettingValue), "FormatList.FormatID == ? && SettingID == ?");
MyObjectSpaceObject.GetObjectSet(typeof(SettingValue), query, formatId, settingId);
or for .NET 2:
OPathQuery query = new OPathQuery<SettingValue>("FormatList.FormatID == ? && SettingID == ?");
MyObjectSpaceObject.GetObjectSet<SettingValue>(query, formatId, settingId); |