在delphi里怎样实现.dbf和oracle数据库之间导入和导出 我是刚学习用odac连接oracle数据库的,想实现dbf和oracle数据库之间的导入导出功能, 怎么办哟,请各位大侠多多帮忙哈. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TfcdrdcF.ImpFromDbf;var i: Integer; str: string; fdr: boolean;begin fdr := False; DataBase2.Close; CreateAlias('yqcb_dbf', DirectoryListBox1.Directory); DataBase2.Open; Gauge1.MaxValue := FileListBox1.SelCount - 1; for i := 0 to (FileListBox1.Items.Count - 1) do begin try if FileListBox1.Selected[i] then begin desfile := FileListBox1.Items.Strings[i]; delete(desfile, 1, 10); delete(desfile, length(desfile) - 3, 4); shortName := desfile; str := copy(FileListBox1.Items.Strings[i], 5, 4) + '-' + copy(FileListBox1.Items.Strings[i], 9, 2) + '-' + '15'; if str <> (fsys_date) then if MessageDlg('导入表' + #39 + shortName + #39 + '的日期和系统日期不同,是否继续导入', mtConfirmation, [mbYes, mbNo], 0) = mrYes then continue else break; if SQlCount(dataBase1.DatabaseName, 'SELECT TABLENAME FROM CBBDIR WHERE TABLENAME=' + #39 + shortName + #39) = 1 then begin Label3.Caption := '正在导入' + ShortName; Label3.Refresh; Gauge1.Progress := i; Impdata(DataBase1.DatabaseName, FileListBox1.Items.Strings[i]); end; fdr := True; end; except raise Exception.Create('导入数据失败:'); end; end; if fdr = True then begin MessageDlg('成功导入数据!', mtInformation, [mbok], 0); Gauge1.Progress := 0; end;end; procedure TfcdrdcF.ExpToDbf;var TmpQuery: Tquery; i, FileCount: Integer; str: string;begin TmpQuery := TQuery.Create(nil); DataBase2.Close; CreateAlias('yqcb_dbf', DirectoryListBox1.Directory); DataBase2.Open; str := 'SELECT TABLENAME FROM CBBDIR WHERE SX=''输出表'' AND TABLENAME IS NOT NULL ORDER BY TABLENAME'; TmpQuery.DatabaseName := Database1.DatabaseName; TmpQuery.SQL.Text := str; TmpQuery.Open; FileCount := TmpQuery.RecordCount; Gauge1.MaxValue := FileCount - 1; for i := 0 to FileCount - 1 do begin Label3.Caption := '正在导出' + TmpQuery.Fields[0].AsString; Panel1.Refresh; Gauge1.Progress := i; bm(TmpQuery.Fields[0].AsString); //batchMove TmpQuery.Next; end; MessageBox(handle, '成功导出数据!', '系统信息', mb_ok); Gauge1.Progress := 0; Label3.Caption := ''; TmpQuery.Free;end; 求AdvStringGrid控件 用到dll,作安装程序时必须注册吗? 怎样把stringgrid内的内容清干净? Delphi 显示过大的json数据时卡机,该如何处理! 關於數據庫編程最基本問題!!!!! 50分索求一个IP地址编辑控件,请大家帮我。 请教:delphi+mapx TCPClient的问题 请教各位高手 delphi 如何在mdi窗体内 实现窗口管理功能?? 关于MaskEdit,非高手莫进 求一sql语句,谢谢各位 请教~如何在DBGRID中更改值,但数据库中不发生变化
var
i: Integer;
str: string;
fdr: boolean;
begin
fdr := False;
DataBase2.Close;
CreateAlias('yqcb_dbf', DirectoryListBox1.Directory);
DataBase2.Open;
Gauge1.MaxValue := FileListBox1.SelCount - 1;
for i := 0 to (FileListBox1.Items.Count - 1) do
begin
try
if FileListBox1.Selected[i] then
begin
desfile := FileListBox1.Items.Strings[i];
delete(desfile, 1, 10);
delete(desfile, length(desfile) - 3, 4);
shortName := desfile;
str := copy(FileListBox1.Items.Strings[i], 5, 4) + '-' + copy(FileListBox1.Items.Strings[i], 9, 2) + '-' + '15';
if str <> (fsys_date) then
if MessageDlg('导入表' + #39 + shortName + #39 + '的日期和系统日期不同,是否继续导入', mtConfirmation,
[mbYes, mbNo], 0) = mrYes then continue
else break;
if SQlCount(dataBase1.DatabaseName, 'SELECT TABLENAME FROM CBBDIR WHERE TABLENAME=' + #39 + shortName + #39) = 1 then
begin
Label3.Caption := '正在导入' + ShortName;
Label3.Refresh;
Gauge1.Progress := i;
Impdata(DataBase1.DatabaseName, FileListBox1.Items.Strings[i]);
end;
fdr := True;
end;
except
raise Exception.Create('导入数据失败:');
end;
end;
if fdr = True then
begin
MessageDlg('成功导入数据!', mtInformation, [mbok], 0);
Gauge1.Progress := 0;
end;
end;
var
TmpQuery: Tquery;
i, FileCount: Integer;
str: string;
begin
TmpQuery := TQuery.Create(nil);
DataBase2.Close;
CreateAlias('yqcb_dbf', DirectoryListBox1.Directory);
DataBase2.Open;
str := 'SELECT TABLENAME FROM CBBDIR WHERE SX=''输出表'' AND TABLENAME IS NOT NULL ORDER BY TABLENAME';
TmpQuery.DatabaseName := Database1.DatabaseName;
TmpQuery.SQL.Text := str;
TmpQuery.Open;
FileCount := TmpQuery.RecordCount;
Gauge1.MaxValue := FileCount - 1;
for i := 0 to FileCount - 1 do
begin
Label3.Caption := '正在导出' + TmpQuery.Fields[0].AsString;
Panel1.Refresh;
Gauge1.Progress := i;
bm(TmpQuery.Fields[0].AsString); //batchMove
TmpQuery.Next;
end;
MessageBox(handle, '成功导出数据!', '系统信息', mb_ok);
Gauge1.Progress := 0;
Label3.Caption := '';
TmpQuery.Free;
end;