shape append


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: shape append

  1. #1
    Dave Kraft Guest

    shape append

    Hi,

    I'm trying to create a hierarchical (sp?) recordset thusly:
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.Provider = "MSDataShape"
    cn.ConnectionString = "Data
    Provider=sqloledb;server=sqlserv;database=Members;user
    id=sa;password=sapass"
    cn.CursorLocation = adUseServer
    rs.CursorLocation = adUseServer
    rs.CursorType = adOpenStatic
    rs.LockType = adLockReadOnly
    rs.Source = "shape (select tblmember.* from tblmember) append (select
    tblorganization.* from tblorganization) relate tblmember.id to
    tblorganization.id as 'orgs'"
    cn.Open
    rs.ActiveConnection = cn
    rs.Open

    Everything seems ok until I open the recordset. Then I get runtime error
    80040e14: "Data shape command text contains a syntax error at or near
    position 13 in the command. The text near the error is "shape (select
    tblmember.* from".

    I've looked at & retyped my shape command 5 times over, and I still get the
    error. I've also tried using server side cursors, all with no avail.
    Anyone know why I'm getting the error?

    TIA

    Dave Kraft
    TSR Solutions, Inc.
    dkraft@tsrnet.com

    My views aren't necessarily my employer's.



  2. #2
    Per Johansson Guest

    Re: shape append


    "Dave Kraft" <dkraft@tsrnet.com> wrote:
    >rs.Source = "shape (select tblmember.* from tblmember) append (select
    >tblorganization.* from tblorganization) relate tblmember.id to
    >tblorganization.id as 'orgs'"
    >
    >Everything seems ok until I open the recordset. Then I get runtime error
    >80040e14: "Data shape command text contains a syntax error at or near
    >position 13 in the command. The text near the error is "shape (select
    >tblmember.* from".


    I think your syntax for the Shape Append command is wrong. This is what the
    ADO reference says:

    SHAPE {parent-command} [[AS] parent-alias]

    APPEND ({child-command} [AS] child-alias

    RELATE parent-column TO child-column...) [[AS] chapter-alias] ...

    So your command should read:

    "SHAPE {SELECT tblmember.* FROM tblmember} AS parent
    APPEND ({SELECT tblorganization.* FROM tblorganization} AS child
    RELATE tblmember.id TO tblorganization.id) AS orgs"

    Best regards
    Per

  3. #3
    Join Date
    Dec 2006
    Posts
    1
    hi, I want to display a report about order details from 't_orderdetails' table that relate to its parent 't_orders' according to their 'order_ID',
    then I want to compute field 'total' from t_orders (parent) grouped by 'date' to get daily-total, and also compute all daily-total in result to 'grandtotal'.

    I develop the command, child command, datareport, and retrieve the structure and it seems all fine, but I get a runtime error:

    Run-time error '-2147217900 (80040e14)':

    Data shape command text contains a syntax error at or near position
    272 in the command. The text near the error is: "
    cmDailyOrderDetails COMPUTE cmDailyOrders,".

    this is my SHAPE command:

    SHAPE ( SHAPE {select t_orders.* from t_orders where Date >= strFrom and Date <= strTo} AS cmDailyOrders APPEND ({SELECT * FROM `t_orderdetails`} AS cmDailyOrderDetails RELATE 'orderID' TO 'orderID') AS cmDailyOrderDetails COMPUTE cmDailyOrders, SUM(cmDailyOrders.'Total') AS DailyTotal BY 'Date') AS Date_Grouping COMPUTE SUM(Date_Grouping.DailyTotal') AS GrandTotal, Date_Grouping

    I'm sorry if the position 272 might be innaccurate bcause I've tried to translate my variable-names into english.

    what can be possibly my mistake(s)?

    Thnx very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center