Solved

How to get MS Database Schema!

Posted on 2006-06-11
1
272 Views
Last Modified: 2010-04-23
Hi, What i am trying to achieve is to be able to get a microsoft database schema based only on database and its location. The purpose of this application is to be able to allow the user to spesify a database as shown underneath and based on this information to be able to get a list of available tables that are in the database. unfortunately i get run time errors.
my code is as follows:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

   
        Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\vb.mdb"
        Dim myConnection As OleDbConnection = New OleDbConnection()

        myConnection.ConnectionString = connString

        ' create a data adapter
        ' ' Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from person", myConnection)

 1*       TextBox1.Text = myConnection.GetSchema().ToString
 End Sub
 Whenever i run the application i get the following error: "Invalid operation. The connection is closed at position 1*."

Does anyone know how to get a schema, the solution doesn't have to be based on the above code , Thanks in advance!
0
Comment
Question by:mmouzakitis
[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
1 Comment
 
LVL 14

Accepted Solution

by:
ptakja earned 500 total points
ID: 16882690
The error stated that the connection is closed. Did you try opening the connection first?

Myconnection.Open
TextBox1.Text = myConnection.GetSchema().ToString
MyConnection.Close

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net winforms sizing/resolution? 4 56
Open a link in vb.net 2 27
VS 2015 is giving [No relevant source lines] 2 40
vb.net datagrid point 4 23
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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