CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Location
    Russia
    Posts
    15

    Same table names within ADO.Recordset

    Hello everyone.

    First of all: Sorry for my English.

    I'm deal with Access, ADO (msado2), Visual Basic 6.0. I've got joinin' one table to itself (like this tabTable INNER JOIN tabTable As tabTable1 ON tabTable.ptrParent = tabTable1.Key) in my query.

    I want get recordset "schema" like this:
    tabTable.Caption
    tabTable.Description
    tabTable1.Caption
    tabTable1.Description

    I'm facin' a problem: there's no a propperty within a ADO-recordset wich sais me Alias-table name. It's only BASETABLENAME exist.

    Please help me to get the "schema" (c. above) programmatically.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Same table names within ADO.Recordset

    Code:
    SELECT 
    	tabTable.Caption	AS TableCaption,
    	tabTable.Description	AS TableDescription,
    	tabTable1.Caption 	AS Table1Caption,
    	tabTable1.Description	AS Table1Description
    ...
    Victor Nijegorodov

  3. #3
    Join Date
    Sep 2010
    Location
    Russia
    Posts
    15

    Re: Same table names within ADO.Recordset

    Thank u for answer, Viktor.

    It's not the answer I expected to recieve.

    I'll try to rephrase the question.

    Imagine the next task:
    You've got a pointer to opened valid recordset. How to obtain an ailiases for all tables from source query? Not a 'source' or 'ActiveCommand.CommandText' from recordset but the aliases. Is it posible to achieve the goal.

    P.S. I'm tryin' to realize following functioability:
    An application reads the SQL-query (like "SELECT * FROM chain of tables..." or "SELECT tab1.*, tab2.Caption... FROM chain of tables). The application constructs a dialog that offer to any user to specify a complex filter. In any case the source query is unknown, until it had been read.

    Is any smart decision exist? I can realize parsin' of a source query by I think it's not smart enough.

Tags for this Thread

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