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

  • SEARCH
  • Home
  • 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 7006615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:30:00+00:00 2026-05-27T21:30:00+00:00

I am guessing that not all SQL is created equally. I am diving into

  • 0

I am guessing that not all SQL is created equally. I am diving into the world of DSNs and ODBC drivers in c# and having a bit of a go at it. I am trying to get all the tables in a database that is defined by a DSN that all I know about it is using a Transoft ODBC driver. I can connect to it and get back tables using the code:

 public void ConnectToData(String dsn)
    {
        System.Data.Odbc.OdbcConnection conn =
            new System.Data.Odbc.OdbcConnection();

        //conn.ConnectionString = "FIL=MS Access;DSN=" + dsn;
        conn.ConnectionString = "DSN=" + dsn; //dsn equals "Company_Shared"
        try
        {
            conn.Open();
            MessageBox.Show("Connected!");
            lstBoxLogs.Items.Add("Connected");                                
            DataTable tableschema = conn.GetSchema("TABLES");
            DataSet set = tableschema.DataSet;  
            // first column name
            for (int i = 0; i < tableschema.Columns.Count; i++)
            {
                lstBoxLogs.Items.Add(tableschema.Columns[i].ColumnName);
            }

            lstBoxLogs.Refresh();
            MessageBox.Show(tableschema.Columns.Count + " tables found");
        }
        catch (Exception ex)
        {
            MessageBox.Show("Failed to connect to data source: " + ex.GetBaseException().Message);
        }
        finally
        {
            conn.Close();
        }
    }

It connects fine, and reports tables but not the tables I know I am looking for in the database what comes back is the following:

TABLE_QUALIFIER
TABLE_OWNER
TABLE_NAME
TABLE_TYPE
REMARKS

I am not sure how to get the actual table names from this information so I can just dump all the data in every table (This is all I want to do). Is this cause I have to read up on what kind of SQL a transoft database uses and does it render the conn.GetSchema("TABLES"); call useless?

  • 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-05-27T21:30:01+00:00Added an answer on May 27, 2026 at 9:30 pm

    Would this work?

    using(DataTable tableschema = conn.GetSchema("TABLES"))
    {
        // first column name
        foreach(DataRow row in tableschema.Rows)
        {
            lstBoxLogs.Items.Add(row["TABLE_NAME"].ToString());
        }
    }
    

    EDIT: Fixed the code to not use the DataSet.

    EDIT: Updated the code for future readers to implement the best practice of disposing of the DataTable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have .sql files that I'm guessing is auto-generated. I did not generate this
Here is my current question: I'm guessing that my problem (described below) is being
What happens? I'm guessing that somehow the post or page is parsed before displaying,
I'm guessing there's something really basic about C# inheritance that I don't understand. Would
I'm guessing the StackOverflow code has something along the lines of a UsersController that
I'm guessing it needs to be something like: CONVERT(CHAR(24), lastModified, 101) However I'm not
I'm guessing it's not a Perl Compatible Regular Expression, since there's a special kind
First of all I won't to say that I'm an expert in database handling,
What I am trying to do is show a window, that does not explicitly
I have looked at various example of the SQL Merge statement.. all of which

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.