Board index » delphi » How to get the database type (ADO vs BDE)

How to get the database type (ADO vs BDE)

Here is my code for checking the database type with BDE

var
 Db : DbDesc;
 arname : array [0..30] of char;
 driver : string;
begin
   DataBase.Connected := true;
   FillChar(Db, SizeOf(Db), #0);
   FillChar(arname,30,#0);
   StrpCopy(arname,DataBase.AliasName);
   check(DbiGetDataBaseDesc(arname,@Db));
   Driver := StrPas(Db.SzDbType);
   if Pos('ORACLE',Driver) <> 0
    then Result := dtOracle
   ...

I don't find any method like "DbiGetDataBaseDesc" with ADO. Do you have any idea ?

Thanks.

 

Re:How to get the database type (ADO vs BDE)


"olivier petiot" <olivier.pet...@cogis.fr> schrieb im Newsbeitrag
news:27be2e4.0209182333.71501b3a@posting.google.com...

Quote
> Here is my code for checking the database type with BDE

> var
>  Db : DbDesc;
>  arname : array [0..30] of char;
>  driver : string;
> begin
>    DataBase.Connected := true;
>    FillChar(Db, SizeOf(Db), #0);
>    FillChar(arname,30,#0);
>    StrpCopy(arname,DataBase.AliasName);
>    check(DbiGetDataBaseDesc(arname,@Db));
>    Driver := StrPas(Db.SzDbType);
>    if Pos('ORACLE',Driver) <> 0
>     then Result := dtOracle
>    ...

> I don't find any method like "DbiGetDataBaseDesc" with ADO. Do you have

any idea ?

TAdoConnection.Provider gives you the type of your Database.

if ADOconnection1.Provider = 'sqloledb' then
    result := dtSQLServer
else if....

See http://www.able-consulting.com/ADO_Conn.htm for more info
about connections and providers.

Andreas Schmidt

--
Database Explorer for ADO (Freeware)
http://www.tobilan.de/adodeskexe.zip

Other Threads