procedure TConvertForm.CopyTable(FromDir, SrcTblName, ToDir, DestTblName: String); var DBHandle: HDBIDB;ResultCode: DBIResult;Src, Dest, Err: Array[0..255] of Char;SrcTbl, DestTbl: TTable;begin SrcTbl := TTable.Create(Application);DestTbl := TTable.Create(Application);trySrcTbl.DatabaseName := FromDir;SrcTbl.TableName := SrcTblName;SrcTbl.Open;DBHandle := SrcTbl.DBHandle;SrcTbl.Close;ResultCode := DbiCopyTable(DBHandle,false,StrPCopy(Src,FromDir + '\' + SrcTblName),nil,StrPCopy(Dest,ToDir + '\' + DestTblName));if (ResultCode <> DBIERR_NONE) thenbeginDbiGetErrorString(ResultCode,Err);raise EDatabaseError.Create('При копировании ' +FromDir + '\' + SrcTblName + ' в ' +ToDir + '\' + DestTblName + ' ,'+ 'BDE сгенерировал ошибку '''+ StrPas(Err) + '''');end;finallySrcTbl.Free;DestTbl.Free;end;end; procedure TConvertForm.DeleteTable(Dir, TblName: String); var DBHandle: HDBIDB;ResultCode: DBIResult;tbl, Err: Array[0..255] of Char;SrcTbl, DestTbl: TTable;SrcTbl := TTable.Create(Application);trySrcTbl.DatabaseName := Dir;SrcTbl.TableName := TblName;SrcTbl.Open;DBHandle := SrcTbl.DBHandle;SrcTbl.Close;ResultCode := DbiDeleteTable(DBHandle,StrPCopy(Tbl,Dir + '\' + TblName),nil);if (ResultCode <> DBIERR_NONE) thenbeginDbiGetErrorString(ResultCode,Err);raise EDatabaseError.Create('Удаляя ' +Dir + '\' + TblName + ', BDE ' +'сгенерировал ошибку '''+ StrPas(Err) + '''');end;finallySrcTbl.Free;end;end; |