这个好做到,以下是我做的程序里的一个过程,没修改,直接帖了出来,
你将就着看吧。可以实现你的SQL SERVER导出的XML文件再导入到SQL SERVER表中去。
----------------------------------------------------------------------------
procedure TfrmImp.ImpData(Path:string);
var
FileName:string;
strError:string;
XmlCount,iTmp,iField:integer;
begin
XmlCount:=xmlListView.Items.Count;
for iTmp:=XmlCount-1 downto 0 do
begin
FileName:=Path+xmlListView.Items.Item[iTmp].Caption;
ADOTable1.Close;
ADOTable1.TableName:=Copy(xmlListView.Items.Item[iTmp].Caption,1,Length(xmlListView.Items.Item[iTmp].Caption)-4);
try
ADOTable1.Open;
ADOQuery1.LoadFromFile(FileName);
ADOQuery1.First;
while not ADOQuery1.Eof do
begin
ADOTable1.Append;
for iField:=0 to ADOQuery1.FieldCount-1 do
begin
ADOTable1.Fields.Fields[iField].Value:=ADOQuery1.Fields.Fields[iField].Value;
end;
ADOTable1.Post();
ADOQuery1.Next();
end;
xmlListView.Items.Item[iTmp].Delete;
Application.ProcessMessages;
except
strError:='导入文件《'+FileName+'》出错';
Application.MessageBox(Pchar(strError),'信息',MB_ICONERROR+MB_OK);
end;
end;
end;
------------------------------------------------------------------------------