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. Get table names in an Access .mdb database

Get table names in an Access .mdb database

Scheduled Pinned Locked Moved C#
csharpdatabasedotnetquestion
4 Posts 2 Posters 1 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.
  • B Offline
    B Offline
    BillAnton
    wrote on last edited by
    #1

    Please take a good look at this and give me some clues!!! I need to list every table in the Access database. This code (which is from the .NET Framework Class Library DataTableCollection Class page on MSDN) appears to get the info that is needed, but what does the dataset coding look like for this to work? private void GetTables(DataSet ds) { // Get Each DataTable in the DataTableCollection and print each row value. foreach (DataTable t in ds.Tables) foreach (DataRow r in t.Rows) foreach (DataColumn c in t.Columns) if (r[c] != null) Console.WriteLine(r[c]); } Regards, Bill Antonacchio

    M 2 Replies Last reply
    0
    • B BillAnton

      Please take a good look at this and give me some clues!!! I need to list every table in the Access database. This code (which is from the .NET Framework Class Library DataTableCollection Class page on MSDN) appears to get the info that is needed, but what does the dataset coding look like for this to work? private void GetTables(DataSet ds) { // Get Each DataTable in the DataTableCollection and print each row value. foreach (DataTable t in ds.Tables) foreach (DataRow r in t.Rows) foreach (DataColumn c in t.Columns) if (r[c] != null) Console.WriteLine(r[c]); } Regards, Bill Antonacchio

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Bill. You're going to want to use the GetOleDbSchemaTable method of the OleDbConnection object to get your list of tables. This Microsoft KB document should help. http://support.microsoft.com/?id=309488[^]

      1 Reply Last reply
      0
      • B BillAnton

        Please take a good look at this and give me some clues!!! I need to list every table in the Access database. This code (which is from the .NET Framework Class Library DataTableCollection Class page on MSDN) appears to get the info that is needed, but what does the dataset coding look like for this to work? private void GetTables(DataSet ds) { // Get Each DataTable in the DataTableCollection and print each row value. foreach (DataTable t in ds.Tables) foreach (DataRow r in t.Rows) foreach (DataColumn c in t.Columns) if (r[c] != null) Console.WriteLine(r[c]); } Regards, Bill Antonacchio

        M Offline
        M Offline
        Mike Ellison
        wrote on last edited by
        #3

        Oops - I gave you the link to the VB.NET version. Here's the C# version: http://support.microsoft.com/default.aspx?scid=kb;EN-US;309681[^]

        B 1 Reply Last reply
        0
        • M Mike Ellison

          Oops - I gave you the link to the VB.NET version. Here's the C# version: http://support.microsoft.com/default.aspx?scid=kb;EN-US;309681[^]

          B Offline
          B Offline
          BillAnton
          wrote on last edited by
          #4

          Thanks Mike I will give that a try. Regards, Bill Antonacchio

          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