[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

How to get the schema from a ODBC provider

Tony

10/11/2002 11:34:00 PM

How do I obtain the schema information (tables and columns) defined for a
specified ODBC data source.

We need something similar to a OleDbConnection.OleDbSchemaTable() method.
ODBC.NET does not appear to provide something similar.

Tony


6 Answers

(Hussein Abuthuraya(MSFT))

10/15/2002 12:17:00 AM

0

Tony,

Have you looked at OdbcDataReader.GetSchemaTable Method?

From the ODBC.NET Help file:

"Returns a DataTable that describes the column metadata of the OdbcDataReader."

Is this what you are looking for?


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

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

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


Tony

10/15/2002 3:54:00 PM

0

Thanks, that's what I need. Was looking on the wrong class.

Tony

"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:Bp8St98cCHA.1896@cpmsftngxa09...
> Tony,
>
> Have you looked at OdbcDataReader.GetSchemaTable Method?
>
> From the ODBC.NET Help file:
>
> "Returns a DataTable that describes the column metadata of the
OdbcDataReader."
>
> Is this what you are looking for?
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>


Tony

10/15/2002 4:00:00 PM

0

Actually, I just verified, that is no what I need. That describes the
readers result set.

I need to be able to get the database schema listing all tables and columns
defined in the odbc database similar to the
OleDbConnection.GetOleDbSchemaTable() method.

I need this before I can create a command to even get to a reader.

Tony

"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:Bp8St98cCHA.1896@cpmsftngxa09...
> Tony,
>
> Have you looked at OdbcDataReader.GetSchemaTable Method?
>
> From the ODBC.NET Help file:
>
> "Returns a DataTable that describes the column metadata of the
OdbcDataReader."
>
> Is this what you are looking for?
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>


(Hussein Abuthuraya(MSFT))

10/15/2002 8:09:00 PM

0

Ah, you want listing of all tables and columns in your database. This is currently not possible using the ODBC .NET Data provider. I'm sure you can query your backend
database for this information using views or stored procedures. For example, for SQL Server you get this info by running the following query:

"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_TYPE"

Other databases should have something similar. What is your backend database?


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

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

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


Tony

10/16/2002 5:39:00 AM

0

We have to be able to import data from any ODBC datasource. Oracle, Sql
server, text, xls, csv, you name it.
Stored procedures won't cut it. We can only read the data, we have no
control over it's creation.
We read the schema, put up a table selection, let the user select a table,
then we let them map the columns to the destination. Pretty standard stuff.
We were just hoping to be able to use the ODBC.NET data provider instead of
going back to coding against the ODBC C API - that's not progress.

Can't believe they left that part out...!

Tony

"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:jHZ6a5HdCHA.1408@cpmsftngxa06...
> Ah, you want listing of all tables and columns in your database. This is
currently not possible using the ODBC .NET Data provider. I'm sure you can
query your backend
> database for this information using views or stored procedures. For
example, for SQL Server you get this info by running the following query:
>
> "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
ORDER BY TABLE_TYPE"
>
> Other databases should have something similar. What is your backend
database?
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>


Jim Stover

11/14/2002 12:01:00 AM

0

I have to second the messages from Tony. We have exactly the same situation
with the need to get all available tables, allow user to choose table and
columns from that table, etc. The one database we are trying to query is a
proprietary database (not a SQL database) and has a limited driver. I have
been able to use tools in other products through C++ before. I was also
hoping for a .NET solution. The only acces to the database we are using is
the ODBC driver. I think the other tools I have used from C++ had sent the
SQLTables() call in the background. We need this same capability with the
.NET ODBC driver!

Jim

"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:jHZ6a5HdCHA.1408@cpmsftngxa06...
> Ah, you want listing of all tables and columns in your database. This is
currently not possible using the ODBC .NET Data provider. I'm sure you can
query your backend
> database for this information using views or stored procedures. For
example, for SQL Server you get this info by running the following query:
>
> "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
ORDER BY TABLE_TYPE"
>
> Other databases should have something similar. What is your backend
database?
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>