CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Posts
    2

    Data Shaping problem

    Hi,

    im trying to create a hierachical flex grid with 2 related tables. but the catch is that i want 1 fabricated field in the first table. i cant seem to find any example for working with data from tables alongwith fabricated fields.

    if anyone can gimme an example of shape command for it.

    thanks,
    Moez.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Data Shaping problem

    'Ref only ActiveX 2.x lib
    Option Explicit

    Private cn As ADODB.Connection
    Private rs As ADODB.Recordset

    Private Sub Form_Resize()
    objGrid.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
    End Sub

    Private Sub Form_Load()
    Dim strSQL As String

    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset

    cn.Provider = "MSDataShape"
    cn.ConnectionString = "Data Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\vb6\prqnew\prq.MDB"
    cn.Open

    rs.Open "SHAPE {select ProducerID, Name, State from ProducerMSTR} " & _
    "APPEND ({select producerid,tanknumber from TankMSTR} " & _
    "RELATE producerid TO producerid) AS tanks", cn

    Set objGrid.DataSource = rs
    End Sub

    '====================
    Parameterized Commands

    Shape commands may be parameterized. For example, you can specify the following:

    "SHAPE {SELECT * FROM customer}
    APPEND {SELECT * FROM orders WHERE cust_id = ?}
    RELATE (cust_id TO PARAMETER 0)"

    In this case, parent and child tables happen to have a column name in common, cust_id. The child-command
    has a placeholder (that is, "?"), to which the RELATE clause refers (that is, "...PARAMETER 0". In effect, the
    relation is between the explicitly identified parent-column, and the child-column implicitly identified by the
    placeholder).



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Aug 2001
    Posts
    2

    Re: Data Shaping problem

    is there a way i can also fabricate a column which is not in the database alongwith the columns already present in the db.

    like the columns would be

    Confirm OrderId Desc


    the column confirm is not present in DB. only the other 2 are...so i want to fabricate this so it looks like a column from db in Hflexgrid

    thanks




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

Featured