DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: how to get information about database in running time?

  1. #1
    chiki Guest

    how to get information about database in running time?


    How can I know how many tabels are in the database and what are they names?
    (in running time)


    thank you very much

    chiki

  2. #2
    Arthur Wood Guest

    Re: how to get information about database in running time?


    Chiki,
    What backend database are you using? It is a very easy query if you are
    using MS Access.

    Arthur Wood

    "chiki" <rpo@hotmail.co.il> wrote:
    >
    >How can I know how many tabels are in the database and what are they names?
    >(in running time)
    >
    >
    >thank you very much
    >
    >chiki



  3. #3
    Larry Rebich Guest

    Re: how to get information about database in running time?

    Chiki:

    If you are using DAO then:

    Private Sub Form_Load()
    Dim sTemp As String
    Dim db As Database
    Dim tb As TableDef
    Set db = OpenDatabase("c:\mmi-pm\Compile History.mdb")
    For Each tb In db.TableDefs
    If (tb.Attributes And dbSystemObject) = 0 Then
    sTemp = "Normal Table: "
    Else
    sTemp = "System Table: "
    End If
    Debug.Print sTemp & tb.Name
    Next
    Unload Me
    End Sub

    Output sample:

    System Table: MSysACEs
    System Table: MSysModules
    System Table: MSysModules2
    System Table: MSysObjects
    System Table: MSysQueries
    System Table: MSysRelationships
    Normal Table: tblAsgnApplicationToFile
    Normal Table: tblCompiledApplication
    Normal Table: tblCompiledFile
    Normal Table: tblControl

    Cheers,
    Larry Rebich

    More tips link to:
    http://www.buygold.net/tips.html

    Please:
    No personal e-mail questions :-)


    "chiki" <rpo@hotmail.co.il> wrote in message
    news:3a322657$1@news.devx.com...
    >
    > How can I know how many tabels are in the database and what are they

    names?
    > (in running time)
    >
    >
    > thank you very much
    >
    > chiki




  4. #4
    Kevin Guest

    Re: how to get information about database in running time?


    Have you tried the OpenSchema method on the ADO connection?
    Here is an example from the MSDN help file.

    'BeginOpenSchemaVB
    Public Sub OpenSchemaX()

    Dim cnn1 As ADODB.Connection
    Dim rstSchema As ADODB.Recordset
    Dim strCnn As String

    Set cnn1 = New ADODB.Connection
    strCnn = "Provider=sqloledb;" & _
    "Data Source=MyServer;Initial Catalog=Pubs;User Id=sa;Password=; "
    cnn1.Open strCnn

    Set rstSchema = cnn1.OpenSchema(adSchemaTables)

    Do Until rstSchema.EOF
    Debug.Print "Table name: " & _
    rstSchema!TABLE_NAME & vbCr & _
    "Table type: " & rstSchema!TABLE_TYPE & vbCr
    rstSchema.MoveNext
    Loop
    rstSchema.Close

    cnn1.Close

    End Sub
    'EndOpenSchemaVB



    "chiki" <rpo@hotmail.co.il> wrote:
    >
    >How can I know how many tabels are in the database and what are they names?
    >(in running time)
    >
    >
    >thank you very much
    >
    >chiki



  5. #5
    Jay Wanek Guest

    Re: how to get information about database in running time?


    "chiki" <rpo@hotmail.co.il> wrote:
    >
    >How can I know how many tabels are in the database and what are they names?
    >(in running time)
    >
    >
    >thank you very much
    >
    >chiki


    Use tabledefs.count if using DAO.


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