Re: ODBC.NET
- From: David Thielen <thielen@xxxxxxxxxxxxx>
- Date: Tue, 10 Oct 2006 12:36:02 -0700
Hi;
Ok, I have it but with 2 things I would like to get better. First, to get
tables or views you can do:
using (OdbcConnection sc = new OdbcConnection(connStr))
{
sc.Open();
DataTable schemaTable = sc.GetSchema("tables"); // or views
for (int ind = 0; ind < schemaTable.Rows.Count; ind++)
if (((string)(schemaTable.Rows[ind])["TABLE_TYPE"]).ToUpper() == "TABLE")
System.Console.WriteLine(" " +
(string)(schemaTable.Rows[ind])["TABLE_NAME"]);
}
I tried using restrictions to get just non-system tables but everything I
tried gave me back no tables.
For stored procedures you can do:
using (OdbcConnection sc = new OdbcConnection(connStr))
{
sc.Open();
DataTable schemaTable = sc.GetSchema("procedures");
for (int ind = 0; ind < schemaTable.Rows.Count; ind++)
System.Console.WriteLine(" " +
(string)(schemaTable.Rows[ind])["PROCEDURE_NAME"]);
}
And for these I have found no way to get just user-defined ones. The
returned data has the same type for all of them.
Any ideas?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
"Kevin Yu [MSFT]" wrote:
Hi Dave,.
The ODBC.NET itself support getting the schema information by using
OdbcConnection.GetSchema method. It can meet all the requirements here.
However, whether a database supports this depends on the database itself
and the driver that vendor has provided. In this case, we cannot say for
sure that we can do or cannot this. It is out of the scope that our app can
reach.
If anything is unclear, please feel free to let me know.
Kevin Yu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
- Follow-Ups:
- Re: ODBC.NET
- From: Kevin Yu [MSFT]
- Re: ODBC.NET
- References:
- Re: ODBC.NET
- From: Mark Rae
- Re: ODBC.NET
- From: Kevin Yu [MSFT]
- Re: ODBC.NET
- Prev by Date: Re: Provider independant Data Access
- Next by Date: Re: Change Connection String at runtime.
- Previous by thread: Re: ODBC.NET
- Next by thread: Re: ODBC.NET
- Index(es):
Relevant Pages
|