On my server machine, I have number of DSN's i.e. for Access, SQL Server,
Sybase, Oracle, Excel etc. I want to write a generic COM method using ADO by
which I can retrive the columns for a particur table for a selected DSN.
Thanks
Al Reid - 29 Sep 2005 18:01 GMT
> On my server machine, I have number of DSN's i.e. for Access, SQL Server,
> Sybase, Oracle, Excel etc. I want to write a generic COM method using ADO by
> which I can retrive the columns for a particur table for a selected DSN.
>
> Thanks
Was there a question there?
BTW, I would avoid using DSN's and use DSNless connections instead.
--
Al Reid
abcd - 29 Sep 2005 18:14 GMT
My question is that is there a generic way to do this. as I tried the below
query and that works only for sybase DSns the same query didnt work for
Access or other databse
select column_name from syscolumn where table_id = (select table_id from
systable where table_name = 'Table1')
[I have DSNs, I can not use DSN less at this moment]
>> On my server machine, I have number of DSN's i.e. for Access, SQL Server,
>> Sybase, Oracle, Excel etc. I want to write a generic COM method using ADO
[quoted text clipped - 9 lines]
> --
> Al Reid
Al Reid - 29 Sep 2005 18:26 GMT
Have a look at the ADO Connection.OpenSchema method. You can use this to obtain schema information from any of those databases.
BTW, having DSN's does not preclude you from going DSN less.
--
Al Reid
> My question is that is there a generic way to do this. as I tried the below
> query and that works only for sybase DSns the same query didnt work for
[quoted text clipped - 18 lines]
> > --
> > Al Reid
abcd - 29 Sep 2005 19:03 GMT
Al Reid thanks.
Infact I am already using ADODB connection's openschema to retrive all table
names for a DSN. I didnt notice that I can retrive columns also...this
solved my issue
thanks
> Have a look at the ADO Connection.OpenSchema method. You can use this to
> obtain schema information from any of those databases.
[quoted text clipped - 30 lines]
>> > --
>> > Al Reid
Someone - 30 Sep 2005 05:04 GMT
FYI, if you want to show the user the OLE DB dialog to create the connection
string, which is the same as shown by VB, look at this article:
How To Invoke the OLE DB Data Link Properties Dialog Box in Visual Basic
Code
http://support.microsoft.com/default.aspx?scid=kb;en-us;286189
Make sure that you add error checking, because the user could click Cancel.
In that case cn.ConnectionString would be = "".
> On my server machine, I have number of DSN's i.e. for Access, SQL Server,
> Sybase, Oracle, Excel etc. I want to write a generic COM method using ADO
> by which I can retrive the columns for a particur table for a selected
> DSN.
>
> Thanks