How to find an existing connection? (Migration Question)

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

How to find an existing connection? (Migration Question)

Post by invent » Tue 16 Jun 2009 11:19

Hi,

I bought the UniDac-Components last month and they are very good. Thank you for your excellent work!

Now I want to migrate my Delphi7-projects and I have a problem and I need your help. I made some library-units with database-functions. The Problems is, that I use these units in different programs and I don't know the Database-Connection.

Example: With the BDE I have this solution:

function GetCustomerName : string;
var MyQuery : TQuery;
begin
MyQuery := TQuery.Create (nil);
MyQuery.Databasename := Session.Databases[0].Databasename;
MyQuery.Sessionname := Session.Databases[0].Sessionname;
MyQuery.Sql.Add('SELECT name FROM customers ... '):
...
end;

I have no idea how to realize such functions with UniDac.

Thanks in advance for any help.

Greetings from Germany
Gerd Brinkmann
invent GmbH

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 17 Jun 2009 09:12

You can pass a reference to the TUniConnection component as a parameter to these functions.

invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

Post by invent » Wed 17 Jun 2009 09:24

Thanks for your answer. A Parameter is not a really good idea. I have to change thousands of lines.

Okay, so I have to find another solution...

Kind regards,
Gerd Brinkmann
invent GmbH

Post Reply