Results 1 to 3 of 3

Thread: [RESOLVED] [VB6] hierarchical recordset

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Resolved [RESOLVED] [VB6] hierarchical recordset

    hi im creating a hierarchical recordset that will be pass as data report datasource but im receiving the error:


    ACCESS VIOLATION or INVALID SYNTAX


    Code:
    Static rs As New ADODB.Recordset
    rs.Open "SHAPE {select pono from tblpurchaseorder} " & _
            "APPEND (select description from tblPurchaseOrderItem) AS orderDetails RELATE tblpurchaseorder.recno TO tblpurchaseorderitem.recno", myConnection, adOpenKeyset, adLockReadOnly
    
    Set rptAllSupplierPO.DataSource = rs
    
    rptAllSupplierPO.show
    btw im using SQL Authentication for the connection object.
    Last edited by jlbantang; Feb 9th, 2009 at 01:40 AM.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: [VB6] hierarchical recordset

    Did you specify the MSDataShape provider in the connection string? For SQL Server it should be

    myConnection.Open "provider=msdatashape; data provider=sqloledb;data source=your server ;initial catalog=your database;integrated security=sspi"

    There is a syntax error in the Shape command. The Related fields must be in both Select statements and each statement must be within curly braces {}

    rs.Open "SHAPE {select recno,pono from tblpurchaseorder} " & _
    "APPEND ({select recno,description from tblPurchaseOrderItem} RELATE recno TO recno) As OrderDetails", myConnection, adOpenKeyset, adLockReadOnly

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: [VB6] hierarchical recordset

    perfect!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width