Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Show tables from sql database

Show tables from sql database

Scheduled Pinned Locked Moved C#
csharpdatabasequestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vcorn
    wrote on last edited by
    #1

    hi, is there any command in ADO.NET to list all tables from a given database name? (in C#)

    H 1 Reply Last reply
    0
    • V vcorn

      hi, is there any command in ADO.NET to list all tables from a given database name? (in C#)

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      ADO.NET is ADO.NET whether you're using C#, VB.NET, MC++, etc. In fact, all assemblies work the same in any managed language. It's important to understand that. That being said, ADO.NET is an abstract interface to any database driver that uses either an OLE DB driver, ODBC driver, or has implemented a specific driver client implementing the ADO.NET interfaces. That does not mean, however, that every feature in a particular database is supported, since abstraction leads to simplification (which is why SQL Server, Oracle, and others have implemented their own clients for ADO.NET). Enumerating databases in a DBMS is different; so, what type of DBMS do you want to enumerate? In SQL Server, you can use the "sp_helpdb" stored procedure. For Access, there is no way other than searching your hard drive for *.mdb, since Access uses Jet Databases, which is a file-based database. It's different for MySQL, Oracle, and others, too.

      Microsoft MVP, Visual C# My Articles

      V 1 Reply Last reply
      0
      • H Heath Stewart

        ADO.NET is ADO.NET whether you're using C#, VB.NET, MC++, etc. In fact, all assemblies work the same in any managed language. It's important to understand that. That being said, ADO.NET is an abstract interface to any database driver that uses either an OLE DB driver, ODBC driver, or has implemented a specific driver client implementing the ADO.NET interfaces. That does not mean, however, that every feature in a particular database is supported, since abstraction leads to simplification (which is why SQL Server, Oracle, and others have implemented their own clients for ADO.NET). Enumerating databases in a DBMS is different; so, what type of DBMS do you want to enumerate? In SQL Server, you can use the "sp_helpdb" stored procedure. For Access, there is no way other than searching your hard drive for *.mdb, since Access uses Jet Databases, which is a file-based database. It's different for MySQL, Oracle, and others, too.

        Microsoft MVP, Visual C# My Articles

        V Offline
        V Offline
        vcorn
        wrote on last edited by
        #3

        in mysql, i can use 'show tables' command to list down all the tables in particular database. i wanna know how to do this in sql server 2000. so that i can use C# to perform such operation using data adapter

        H 1 Reply Last reply
        0
        • V vcorn

          in mysql, i can use 'show tables' command to list down all the tables in particular database. i wanna know how to do this in sql server 2000. so that i can use C# to perform such operation using data adapter

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          There's several ways you can show tables in SQL Server, the easiest being the INFORMATION_SCHEMA metadata table:

          SELECT table_name
          FROM INFORMATION_SCHEMA.TABLES

          You can also query the sysobjects table:

          SELECT name
          FROM sysobjects
          WHERE xtype = 'U' or xtype = 'S' -- U for user tables, S for system tables

          Microsoft MVP, Visual C# My Articles

          V 1 Reply Last reply
          0
          • H Heath Stewart

            There's several ways you can show tables in SQL Server, the easiest being the INFORMATION_SCHEMA metadata table:

            SELECT table_name
            FROM INFORMATION_SCHEMA.TABLES

            You can also query the sysobjects table:

            SELECT name
            FROM sysobjects
            WHERE xtype = 'U' or xtype = 'S' -- U for user tables, S for system tables

            Microsoft MVP, Visual C# My Articles

            V Offline
            V Offline
            vcorn
            wrote on last edited by
            #5

            Thank you:)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups