Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:27:19+00:00 2026-06-10T03:27:19+00:00

the code below returns the fields of a given table (Employee), but I need

  • 0

the code below returns the fields of a given table (“Employee”), but I need to return the fields of ALL the tables in the given database, is this possible? My assumption is a For loop which loops round the tables in the database and prints the corresponding fields but my efforts seem to be in vain

Public Sub getDbFields()

    Dim i As Integer
    Dim dbcon As New System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & dblocation & _
                                               "\" & dbname)
    Try

        dbcon.Open()
        dbDt = dbcon.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Columns, New Object() _
                                         {Nothing, Nothing, "Employee", Nothing})

        For i = 0 To dbDt.Rows.Count - 1
            'compile lbtables with a list of available tables from the database
            newLine()
            frmMain.lstTables.Items.Add(dbDt.Rows(i)!COLUMN_NAME.ToString())
        Next

    Catch ex As Exception
        MessageBox.Show(ex.Message.ToString(), "Data Load Error", MessageBoxButtons.OK,
            MessageBoxIcon.Exclamation)
    End Try

End Sub

This routine will be fired from the selection of a checkbox

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:27:21+00:00Added an answer on June 10, 2026 at 3:27 am

    This will return all columns on a database

    Using con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" + 
                              "Data Source=" + dblocation + "\" + dbname)
        con.Open()
        Dim schema as DataTable = con.GetSchema("COLUMNS")
        Dim dr as DataRow
        For Each dr in schema.Rows
            Dim tablename as string = dr("TABLE_NAME").ToString()    
            if Not tablename.StartsWith("MSys") then
                Console.WriteLine(dr("TABLE_NAME").ToString() + " " + dr("COLUMN_NAME").ToString())
            End if        
        Next    
    End Using
    

    Please note that the bang (!) syntax is not allowed in vb.net.
    Also your code could work if you change

     dbDt = dbcon.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Columns, New Object() _ 
                                              {Nothing, Nothing, Nothing, Nothing}) 
    

    and this line

    frmMain.lstTables.Items.Add(dbDt.Rows(i)("COLUMN_NAME").ToString()) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below returns the 10 most recent entries to a MySQL database. That's
In the code below, the echo at the top returns true, but the echo
The code below returns the number of resolved tickets and the number of opened
The code below correctly returns the XML from the soap sever that I'm accessing.
HI: Below code is from RequestFactoryEditorDriver: /** * Returns a new array containing the
Is there a way to get the code below to return null if no
Hello everyone I'm currently having 2 issues with the code below: Upon return of
In the below code how does passing bar as function (n) { return n;
Check the below code int add(int a, int b) { return a + b;
i have this function in jquery that verify if ALL the fields have at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.