Watch, Follow, &
Connect with Us
Public Report
Report From: C#Builder/ECO/Persistence Layer    [ Add a report in this area ]  
Report #:  34269   Status: Closed
OclPsHandle,  MaxAnwers and Offset would add the "TOP " clause in SQL Server
Project:  C#Builder Build #:  6041
Version:    10.0 Submitted By:   daniellodeito lodeiro
Report Type:  Basic functionality failure Date Reported:  9/21/2006 8:49:52 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   242139
Resolution: Inactive (Resolution Comments) Resolved in Build: : 11.0.2804.9245
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 1
Description
Using OclPsHandle you can change the MaxAnwers and Offset properties and always in the back (watch trace) get the same sql sentence without the sentence TOP in the select, a litle example was post in Borland.Public.Attachments with subject:
"Testing ECO navigator" the topic was discussed in the borland.public.delphi.modeldrivenarchitecture.eco theard with subject: Paging of the datagrid? Date:  14-09-2006

regards
Frank
Steps to Reproduce:
posted the testing app  in Borland.Public.Attachments, but the code is it:
  private void Page_Load(object sender, System.EventArgs e)
  {
   EcoSpace.Active = true;
   string id = Request.Params["RootId"];
   if ((id != null) && (id != ""))
    rhRoot.SetElement(ObjectForId(id));
   if (!IsPostBack)
            {
                sqlCount.Execute();
                Nav.ItemCount = sqlCount.Element.GetAsCollection().Count;
                DataBind();
            }
  }
private void dataGrid1_DataBinding(object sender, System.EventArgs e)
        {
            sqlOrder.Offset = Nav.FirstItemIndex;
            sqlOrder.MaxAnswers = Nav.ItemsPerPage;
            sqlOrder.Execute();
        }
private void Nav_PageNumberChanged(object sender, System.EventArgs e)
        {
            DataBind();
        }
The trouble is in each roudtrip to get a new page the databind method in the
datagrid1 is call
and then
sqlOrder.Execute() is executed and the trace I watch
<<SELECT Order_TBL_1.ECO_ID
FROM Order_TBL Order_TBL_1
WHERE (Order_TBL_1.OrderID > 50)
ORDER BY Order_TBL_1.OrderID
>>

and 10:
1- << exec sp_executesql N'SELECT Order_TBL_ALIAS.ECO_ID,
Order_TBL_ALIAS.ECO_TYPE, Order_TBL_ALIAS.OrderID,
Order_TBL_ALIAS.Description, Order_TBL_ALIAS.Total, Order_TBL_ALIAS.Status
FROM Order_TBL Order_TBL_ALIAS WHERE Order_TBL_ALIAS.ECO_ID = @ID0', N'@ID0
int', @ID0 = 81>>


2- << the same, @ID0 = 82 >>
...
10- << the same, @ID0 = 90 >>


To me always is fetched 950 ECO ID's not only in the load.


Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01