全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1268
推到 Plurk!
推到 Facebook!

怎样将远程Oracle中的table导出到本地的dbf?

尚未結案
liangzai
初階會員


發表:77
回覆:91
積分:33
註冊:2004-08-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-11-17 14:15:30 IP:219.137.xxx.xxx 未訂閱
请教各位前辈: 怎样将远程Oracle中的table1导出到本地的table1.dbf?急。。。谢谢!
kgt
高階會員


發表:17
回覆:308
積分:165
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-11-17 21:08:12 IP:61.219.xxx.xxx 未訂閱
本地的table1.dbf是那種DB? 可考慮將ORACLE先轉成文字檔,再將文字檔轉成table1.dbf
tonytop
中階會員


發表:6
回覆:114
積分:89
註冊:2003-12-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-11-19 22:23:42 IP:203.204.xxx.xxx 未訂閱
可以用DbiCopyTable這個指令達成,請看以下範例,之前改寫過oracle轉dbf是可行的,加油吧! Copy/ delete a BDE table From: "David S. Becker" Here is an example of a routine that I use for copying and deleting tables. It uses DB, DBTables, DbiProcs,DbiErrs, and DbiTypes. You simply provide the directory to copy from, the source table name, the directory to copy to, and the destination table name, and the BDE will copy the entire table, indexes and all to the new file. The delete function takes the path to delete from and the name of the table to delete, the BDE takes care of deleting all associated files (indexes, etc.). These procedures have been pulled off a form of mine, and I've edited them to remove some dependencies that existed with that form. They should now be completely stand-alone.
   
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);
  try
    SrcTbl.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 then
    begin
      DbiGetErrorString(ResultCode,Err);
      raise EDatabaseError.Create('While copying '  
        FromDir   '\'   SrcTblName   ' to '  
        ToDir   '\'    DestTblName   ', the '
          ' database engine   generated the error '''
          StrPas(Err)   '''');
    end;
  finally
    SrcTbl.Free;
    DestTbl.Free;
  end;
end
<[忙盲茫]> ☆俺要升級啊☆
系統時間:2024-06-16 19:33:11
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!