Multiple Database connections
Dear Reader
I would like to write a program, that restores the data of a backup database
into the original database.
For this I wrote the following function. But when I execute the function the
message comes up, that the type for the field Xfis_T:MNU is unknown, but
Xfis_b is the database and MNU the tablename in the Xfis_b databas.
The manual for Delphi 1 wrote, that the : sign should preceed the database
name, but no change.
Do you have an hint.
procedure TfrmTransfer.BitBtn1Click(Sender: TObject);
var
_sqlstr: string;
_inssql: TStringList;
_i: integer;
begin
try
_inssql := TStringList.Create;
try
if (seTransfer.Active = False) then seTransfer.Active := True;
if (Xfis_b.Connected = False) then Xfis_b.Connected := True;
if (Xfis_T.Connected = False) then Xfis_T.Connected := True;
sttTable.Caption := 'Menu';
gaProgress.MinValue := 0;
gaProgress.MaxValue := 1;
gaProgress.Progress := 0;
if (quBackup.Active = True) then quBackup.Active := False;
if (quTest.Active = True) then quTest.Active := False;
_sqlstr := 'Select * from MNU';
quBackup.SQL.Clear;
quBackup.SQL.Add(_sqlStr);
quBackup.Active := True;
_inssql.Add(' Insert into MNU (MNU_I, ACSRHT, MNUCRY, PGM, PGMNAM)');
_inssql.Add(' Select MNU_I, ACSRHT, MNUCRY, PGM, PGMNAM from
:Xfis_b:MNU');
for _i := 0 to _inssql.count -1 do
quTest.SQL.Add(_inssql[_i]);
quTest.ExecSQL;
gaProgress.Progress := 1;
finally
_inssql.free;
end;
except on E: Exception do
showmessage(E.Message);
end;
end;
Thanks in advance.
Kind regards
Rene Heusser