Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get MS Database Schema!

Posted on 2006-06-11
1
Medium Priority
?
283 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 1500 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

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 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