[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Can I list the Tables from any ODBC Datasource?

Richard

11/28/2002 6:41:00 PM

Dear All,

I have started using ODBC for .NET and I use the registry to enumerate the
DSN names on a local machine then when a user has selected the DSN name I
want to be able to list the Datatables available through that DSN.

I have seen some examples but none work with ODBC connections they all use
OLEDB schema requests. Can anyone help?

Thanks in Advance

Richard


2 Answers

Henning Sommerkamp

12/2/2002 1:37:00 PM

0

Hi Richard,

Richard wrote:

> Dear All,
>
> I have started using ODBC for .NET and I use the registry to enumerate
> the DSN names on a local machine then when a user has selected the DSN
> name I want to be able to list the Datatables available through that DSN.
>
> I have seen some examples but none work with ODBC connections they all
> use OLEDB schema requests. Can anyone help?

On 15.10.2002 21:09 Hussein Abuthuraya of Microsoft Developer Support
stated in this group that the .net ODBC Driver is not capable of
performing that task at all.

I guess you have to switch back to VB6 or so since you have more
features there than in .net.

What I found out anyway is, that you can use ADODB to connect so ODBC
sources. In VB.net it works this way:

Dim con As New ADODB.ConnectionClass()
con.Open("my-dsn-name", "certiuser", "certiuser")

Dim rsTabs As ADODB.Recordset
Dim rsCols As ADODB.Recordset
rsTabs = con.OpenSchema(ADODB.SchemaEnum.adSchemaTables)
rsCols = con.OpenSchema(ADODB.SchemaEnum.adSchemaColumns)

...now I can get all schemas from the recordsets.
Anyway, this did not work with mysql sources, but with sapdb it was just
fine.

cheers,
Henning

Richard

12/4/2002 6:06:00 PM

0

Thanks for the reply unfortunately I have migrated from Delphi to Visual
Studio C# and therefore do not have VB6.

Maybe microsoft will release a better version of ODBC.Net in the future?

For now it's back to Borland.

Regards

Richard

"Henning Sommerkamp" <ganix@gmx.net> wrote in message
news:asfk5t$qnr$05$1@news.t-online.com...
> Hi Richard,
>
> Richard wrote:
>
> > Dear All,
> >
> > I have started using ODBC for .NET and I use the registry to enumerate
> > the DSN names on a local machine then when a user has selected the DSN
> > name I want to be able to list the Datatables available through that
DSN.
> >
> > I have seen some examples but none work with ODBC connections they all
> > use OLEDB schema requests. Can anyone help?
>
> On 15.10.2002 21:09 Hussein Abuthuraya of Microsoft Developer Support
> stated in this group that the .net ODBC Driver is not capable of
> performing that task at all.
>
> I guess you have to switch back to VB6 or so since you have more
> features there than in .net.
>
> What I found out anyway is, that you can use ADODB to connect so ODBC
> sources. In VB.net it works this way:
>
> Dim con As New ADODB.ConnectionClass()
> con.Open("my-dsn-name", "certiuser", "certiuser")
>
> Dim rsTabs As ADODB.Recordset
> Dim rsCols As ADODB.Recordset
> rsTabs = con.OpenSchema(ADODB.SchemaEnum.adSchemaTables)
> rsCols = con.OpenSchema(ADODB.SchemaEnum.adSchemaColumns)
>
> ...now I can get all schemas from the recordsets.
> Anyway, this did not work with mysql sources, but with sapdb it was just
> fine.
>
> cheers,
> Henning
>