Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.net Get Access Columns and Data Types

Posted on 2013-01-16
2
Medium Priority
?
1,766 Views
Last Modified: 2013-01-16
Hi

How do I change the following codes to get all the table names, columns and column data types and then display the results in a DataGridView

    Function GetTableRelationships(ByVal sDataBase As String)
        Try
            'Connect to the Northwind database in SQL Server.
            'Be sure to use an account that has permission to list tables.
            'cn.ConnectionString = "Provider=SQLOLEDB;Data Source=server;User ID=<username>;Password=<strong password>;Initial Catalog=Northwind"

            Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDataBase
            Dim cn As New OleDbConnection(strConnection)


            Dim dt As DataTable

            dt = cn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Foreign_Keys, _
            New Object() {Nothing, Nothing, Nothing, "TABLE"})

            DataGridView1.DataSource = dt
        Catch
            frmR.TopMost = False
            Me.TopMost = False
            MsgBox("There was an error! " & Err.Description & ".")
            frmR.TopMost = True
            Me.TopMost = True
        End Try


    End Function
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38784207
0
 

Author Closing Comment

by:Murray Brown
ID: 38784230
Thanks very much
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question