You can establish a database connection using AdoDbx Client in several ways.
uses System.Data.Common ... var Factory: System.Data.Common.DbProviderFactory; Connection: System.Data.Common.DbConnection; begin Factory := System.Data.Common.DbProviderFactories.GetFactory('Borland.Data.AdoDbxClient'); Connection := Factory.CreateConnection(); Connection.ConnectionString := 'ConnectionName=IBConnection'; Connection.Open; end
<add name="IBConnection" connectionString="ConnectionName=IBCONNECTION; drivername=Interbase; database=workerbee:C:\Borland\Interbase\examples\database\employee.gdb; rolename=RoleName; user_name=user; password=password; sqldialect=3;localecode=0000;blobsize=-1; commitretain=False;waitonlocks=True;interbase transisolation=ReadCommited; trim char=False" providerName="Borland.Data.AdoDbxClient"/>
var Factory: System.Data.Common.DbProviderFactory; Connection: System.Data.Common.DbConnection; Config: System.Configuration.Configuration; ConnectSection: System.Configuration.ConnectionStringsSection; CurrentSettings: System.Configuration.ConnectionStringSettings; begin Factory:= System.Data.Common.DbProviderFactories.GetFactory('Borland.Data.AdoDbxClient'); Connection:= Factory.CreateConnection(); Config:= System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ConnectSection:= Config.ConnectionStrings; CurrentSettings:= ConnectSection.ConnectionStrings['IBConnection']; Connection.ConnectionString:= CurrentSettings.ConnectionString; Connection.Open; end;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|