Solved

How to get MS Database Schema!

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

19 Experts available now in Live!

Get 1:1 Help Now