This question is locked. New answers and comments are not allowed.
Hi, I am just starting with OpenAccess and thought the first thing to try would be to output some information into a gridview. But I am getting the following error:
Exception Details: Telerik.OpenAccess.Exceptions.InvalidOperationException: Any operation that will fully resolve the query may not be called once a 'get' operation was performed
Source Error:
Source File: C:\Project Files\IC-Solutions\IC-Solutions\IC-Solutions\Default.aspx.cs Line: 78
Stack Trace:
The page looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SiteDataObjects;
using Telerik.OpenAccess;
namespace IC_Solutions
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
/*IObjectScope scope = ObjectScopeProvider1.ObjectScope();
scope.Transaction.Begin();
IQueryResult result = scope.GetOqlQuery("Select * from ProductExtent AS x").Execute();
RadGrid1.DataSource = result;
scope.Transaction.Rollback();*/
}
protected void Button2_Click(object sender, EventArgs e)
{
IObjectScope scope = ObjectScopeProvider1.ObjectScope();
IQueryResult result = scope.GetOqlQuery("Select * from ProductExtent AS x where x.ProductTitle Like $1").Execute("*" + TextBox1.Text +"*" );
RadGrid1.DataSource = result;
}
}
}
And a Product looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.OpenAccess;
namespace SiteDataObjects
{
[Persistent]
public class Product
{
public long productID;
public string ProductTitle;
public string ProductShortDescription;
public string ProductDetails;
public ManufacturerManufacturer;
public Category Category;
public IList<SupplierProduct> SupplierItems = new List<SupplierProduct>();
public TaxCode Tax;
public IList<Product> RelatedProducts = new List<Product>();
}
Any ideas?
Thanks in advanced
Any operation that will fully resolve the query may not be called once a 'get' operation was performed
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: Telerik.OpenAccess.Exceptions.InvalidOperationException: Any operation that will fully resolve the query may not be called once a 'get' operation was performed
Source Error:
Line 76:
Line 77: RadGrid1.DataSource = result;
Line 78: RadGrid1.DataBind();
Line 79: }
Line 80:
|
Source File: C:\Project Files\IC-Solutions\IC-Solutions\IC-Solutions\Default.aspx.cs Line: 78
Stack Trace:
[InvalidOperationException: Any operation that will fully resolve the query may not be called once a 'get' operation was performed] Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28 Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34 OpenAccessRuntime.DataObjects.ForwardQueryResult.resolve() +117 OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Count() +107 Telerik.OpenAccess.RT.ListEnumerator.get_Count() +42 Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +2136 Telerik.Web.UI.GridResolveEnumerable.Initialize() +55 Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +40 Telerik.Web.UI.GridResolveEnumerable.get_DataTable() +31 Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +222 Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +155 Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +556 Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +219 Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +73 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142 Telerik.Web.UI.GridTableView.PerformSelect() +28 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 Telerik.Web.UI.GridTableView.DataBind() +365 Telerik.Web.UI.RadGrid.DataBind() +165 IC_Solutions._Default.Button2_Click(Object sender, EventArgs e) in C:\Project Files\IC-Solutions\IC-Solutions\IC-Solutions\Default.aspx.cs:78 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
The page looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SiteDataObjects;
using Telerik.OpenAccess;
namespace IC_Solutions
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
/*IObjectScope scope = ObjectScopeProvider1.ObjectScope();
scope.Transaction.Begin();
IQueryResult result = scope.GetOqlQuery("Select * from ProductExtent AS x").Execute();
RadGrid1.DataSource = result;
scope.Transaction.Rollback();*/
}
protected void Button2_Click(object sender, EventArgs e)
{
IObjectScope scope = ObjectScopeProvider1.ObjectScope();
IQueryResult result = scope.GetOqlQuery("Select * from ProductExtent AS x where x.ProductTitle Like $1").Execute("*" + TextBox1.Text +"*" );
RadGrid1.DataSource = result;
}
}
}
And a Product looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.OpenAccess;
namespace SiteDataObjects
{
[Persistent]
public class Product
{
public long productID;
public string ProductTitle;
public string ProductShortDescription;
public string ProductDetails;
public ManufacturerManufacturer;
public Category Category;
public IList<SupplierProduct> SupplierItems = new List<SupplierProduct>();
public TaxCode Tax;
public IList<Product> RelatedProducts = new List<Product>();
}
Any ideas?
Thanks in advanced