Solved

How to get MS Database Schema!

Posted on 2006-06-11
1
253 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now