0

以下代码来自此处的文档:

Program ConnectDB

var AConnection : TSQLConnection;

Procedure CreateConnection;
begin
  AConnection := TIBConnection.Create(nil);
  AConnection.Hostname := 'localhost';
  AConnection.DatabaseName := '/opt/firebird/examples/employee.fdb';
  AConnection.UserName := 'sysdba';
  AConnection.Password := 'masterkey';
end;

begin
  CreateConnection;
  AConnection.Open;
  if Aconnection.Connected then
    writeln('Succesful connect!')
  else
    writeln('This is not possible, because if the connection failed, ' +
            'an exception should be raised, so this code would not ' +
            'be executed');
  AConnection.Close;
  AConnection.Free;
end.

代码的主体对我来说很有意义,但我不知道TSQLConnection从哪里来。我也不能使用CTRL + Space来自动完成它,这意味着我的程序没有引用它。顺便说一句,我正在尝试连接到 Postgres。

有人可以说明TSQLConnection是什么吗?谢谢!

4

1 回答 1

2

TSQLConnection对象在sqldb单元中定义,是特定连接组件(如TIBConnection(interbase、firebird)、TConnectionName(mysql)和TPQConnection(postgres)的基类。

于 2012-10-30T05:42:05.820 回答