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. Database & SysAdmin
  3. Database
  4. Table Names Of a MS Access Database

Table Names Of a MS Access Database

Scheduled Pinned Locked Moved Database
databasewindows-adminhelp
5 Posts 4 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.
  • D Offline
    D Offline
    Daminda
    wrote on last edited by
    #1

    I Want to List the Table Names Of a MS Access Database Using ADO Connection. This is How I tried ADODB.Connection myConnection = new ADODB.ConnectionClass(); ADODB.Recordset rsTblNames = new ADODB.RecordsetClass(); if (optAccess.Checked) { ConnStr= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Data Source="+ txtDbPath.Text +";Mode=ReadWrite;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; myConnection.Open(ConnStr,"","",0); StrSql= "SELECT Name FROM MSysObjects WHERE Type = 1"; rsTblNames.Open(StrSql, myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly,0); } But This returns a Error

    I T 2 Replies Last reply
    0
    • D Daminda

      I Want to List the Table Names Of a MS Access Database Using ADO Connection. This is How I tried ADODB.Connection myConnection = new ADODB.ConnectionClass(); ADODB.Recordset rsTblNames = new ADODB.RecordsetClass(); if (optAccess.Checked) { ConnStr= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Data Source="+ txtDbPath.Text +";Mode=ReadWrite;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; myConnection.Open(ConnStr,"","",0); StrSql= "SELECT Name FROM MSysObjects WHERE Type = 1"; rsTblNames.Open(StrSql, myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly,0); } But This returns a Error

      I Offline
      I Offline
      Ian Darling
      wrote on last edited by
      #2

      You might want to try ADOX instead, although I'm not sure if it works with Access.


      Ian Darling "The different versions of the UN*X brand operating system are numbered in a logical sequence: 5, 6, 7, 2, 2.9, 3, 4.0, III, 4.1, V, 4.2, V.2, and 4.3" - Alan Filipski

      1 Reply Last reply
      0
      • D Daminda

        I Want to List the Table Names Of a MS Access Database Using ADO Connection. This is How I tried ADODB.Connection myConnection = new ADODB.ConnectionClass(); ADODB.Recordset rsTblNames = new ADODB.RecordsetClass(); if (optAccess.Checked) { ConnStr= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Data Source="+ txtDbPath.Text +";Mode=ReadWrite;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; myConnection.Open(ConnStr,"","",0); StrSql= "SELECT Name FROM MSysObjects WHERE Type = 1"; rsTblNames.Open(StrSql, myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly,0); } But This returns a Error

        T Offline
        T Offline
        Thea Burger
        wrote on last edited by
        #3

        Try this: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Source: http://www.sadeveloper.net/Forum/ShowPost.aspx?PostID=5153 (There are more info if you need it)

        F 1 Reply Last reply
        0
        • T Thea Burger

          Try this: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Source: http://www.sadeveloper.net/Forum/ShowPost.aspx?PostID=5153 (There are more info if you need it)

          F Offline
          F Offline
          FASTian
          wrote on last edited by
          #4

          Is there any way we can get the column/field names of a table in access??

          T 1 Reply Last reply
          0
          • F FASTian

            Is there any way we can get the column/field names of a table in access??

            T Offline
            T Offline
            Thea Burger
            wrote on last edited by
            #5

            Hi, Try this: dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=myDB;User ID=xxx;Password=xxx;"; dbCon.Open(); DataTable dt = dbCon.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, null); foreach(DataRow myRow in dt.Rows) { if (myRow["TABLE_NAME"].ToString() == tabSel) { ColList.Items.Add(myRow["COLUMN_NAME"].ToString()); } } This is also from the link that I posted above, here it is again: http://www.sadeveloper.net/Forum/ShowPost.aspx?PostID=5153 HTH, -Thea-

            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