Subject | Re: [IBO] IB Connection |
---|---|
Author | Geoff Worboys |
Post date | 2001-03-07T01:34:01Z |
> I am new to Delphi, Interbase and IBObjects though I am notWow, you are in for an interesting time! :-)
> new to programming or dbs.
Simple bits first...
> if IB_Connection1.Connected"Connected" is a property not a function. Delphi properties can be
readonly, writeonly or read and write.
Reading...
A := IB_Connection.Connected;
or
If IB_Connection.Connected then
Writing...
IB_Connection.Connected := A;
So to connect in this example you must set the property value. For
example...
// Try and set connected to true
IB_Connection.Connected := true;
// now test if actually connected
if IB_Connection1.Connected
then
label2.Caption := 'Connected'
else
label2.Caption := 'Not Connected';
Now the more complicated aspect, which may be redundant...
> if FileExists(IB_Connection1.Path)You may or may not know that this will ONLY work for a local
installation. The Path information is always the full, real path of
the database file ON THE SERVER. With a local installation the server
is where you are, so the code works. With a remote installation this
is not possible. All you can do is try to connect and respond to any
exceptions that may occur.
HTH
Geoff Worboys
Telesis Computing