This question is locked. New answers and comments are not allowed.
I'm using an OpenAccessDataSource:
In the "oadsPackages_OnSelecting" event, I have the following code:
Additionally, I have a RadGrid with it's "DataSourceID" property set to "oadsPackages". When I call the "Rebind()" method on this RadGrid, the "OnSelecting" code of the "oadsPackages" is run but before the "RadGrid.Rebind()" method returns, an error is thrown which states:
line 1:132: expecting "right parenthesis", found ','
Original Query: DEFINE EXTENT xt FOR VirtualOffice.Model.Package; SELECT * FROM xt AS this WHERE AssetId IN ('a4f58729-b822-4f77-9ee6-a956123ab53a','877a1486-bfdc-46e9-a83f-a3a670835309','03fcb68f-8d1c-4705-8832-7ec89208ddb6') ORDER BY this.Description
(emphasis added)
I can't understand why I would get this error. Perhaps the IN clause is formatted incorrectly? When I run this exact WHERE...IN clause in MS SQL Management Studio, it runs just fine. I imagine that OQL parses this different, somehow. Any help would be much appreciated.
<telerik:OpenAccessDataSource ID="oadsPackages" runat="server" ObjectContextProvider="NAMESPACE.VirtualOfficeContext, NAMESPACE" TypeName="NAMESPACE.Package" EnableDelete="False" EnableInsert="False" EnableUpdate="False" OrderBy="Description" OnSelecting="oadsPackages_OnSelecting"> </telerik:OpenAccessDataSource>
In the "oadsPackages_OnSelecting" event, I have the following code:
public void oadsPackages_OnSelecting(object sender, Telerik.OpenAccess.OpenAccessDataSourceSelectingEventArgs e) { try { if(SelectedResourcePool != null) { string inClausePackageIds = ""; foreach(Guid AssetId in SelectedResourcePool.ResourcePoolPackages.Select(rpp => rpp.PackageId)) inClausePackageIds += "'" + AssetId + "',"; string whereClause = string.Format("AssetId IN ({0})", inClausePackageIds.TrimEnd(',')); e.DataSource.Where = whereClause; } else { e.DataSource.Where = string.Format("False"); } } catch(Exception ex) { Master.DisplayError(ex.Message); } }
Additionally, I have a RadGrid with it's "DataSourceID" property set to "oadsPackages". When I call the "Rebind()" method on this RadGrid, the "OnSelecting" code of the "oadsPackages" is run but before the "RadGrid.Rebind()" method returns, an error is thrown which states:
line 1:132: expecting "right parenthesis", found ','
Original Query: DEFINE EXTENT xt FOR VirtualOffice.Model.Package; SELECT * FROM xt AS this WHERE AssetId IN ('a4f58729-b822-4f77-9ee6-a956123ab53a','877a1486-bfdc-46e9-a83f-a3a670835309','03fcb68f-8d1c-4705-8832-7ec89208ddb6') ORDER BY this.Description
(emphasis added)
I can't understand why I would get this error. Perhaps the IN clause is formatted incorrectly? When I run this exact WHERE...IN clause in MS SQL Management Studio, it runs just fine. I imagine that OQL parses this different, somehow. Any help would be much appreciated.