List MS Access Queries from VB.NET

K

Kevin Forbes

So, I've found how to list all the tables in an Access database (as
seen below) and running MS Access queries is easy (similar to
executing a stored procedure), but how do I list the names of all of
the queries in the access database?


'RETURNS: ARRAYLIST OF ALL TABLES IN A DATABASE
Dim objDataTable As DataTable =
cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _
New Object() {Nothing, Nothing, Nothing, "TABLE"})

Dim arrListTables As New ArrayList
Dim i As Integer
For i = 0 To objDataTable.Rows.Count - 1
arrListTables.Add(objDataTable.Rows(i)(2))
Next


thanks,
Kev
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Kevin Forbes) scripsit:
So, I've found how to list all the tables in an Access database (as
seen below) and running MS Access queries is easy (similar to
executing a stored procedure), but how do I list the names of all of
the queries in the access database?

Notice that a separate group for ADO.NET related question is available:

<
Web interface:

<http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
K

Kevin Yu [MSFT]

Hi Kev,

You can use the following to get the Queries.

Dim objDataTable As DataTable =
cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _
New Object() {Nothing, Nothing, Nothing, "VIEW"})

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (Kevin Forbes)
| Newsgroups: microsoft.public.dotnet.languages.vb
| Subject: List MS Access Queries from VB.NET
| Date: 13 Nov 2003 12:59:42 -0800
| Organization: http://groups.google.com
| Lines: 20
| Message-ID: <[email protected]>
| NNTP-Posting-Host: 198.103.172.9
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1068757182 3810 127.0.0.1 (13 Nov 2003
20:59:42 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 13 Nov 2003 20:59:42 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews1.google.com!no
t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:156639
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| So, I've found how to list all the tables in an Access database (as
| seen below) and running MS Access queries is easy (similar to
| executing a stored procedure), but how do I list the names of all of
| the queries in the access database?
|
|
| 'RETURNS: ARRAYLIST OF ALL TABLES IN A DATABASE
| Dim objDataTable As DataTable =
| cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _
| New Object() {Nothing, Nothing, Nothing, "TABLE"})
|
| Dim arrListTables As New ArrayList
| Dim i As Integer
| For i = 0 To objDataTable.Rows.Count - 1
| arrListTables.Add(objDataTable.Rows(i)(2))
| Next
|
|
| thanks,
| Kev
|
 
K

Kevin Forbes

Thank you, that works perfectly.

I will post in the appropriate newsgroup next time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top