procedure DoAdoSql(CurADODS: TADODataSet; SSql: string);
var
oldcur: tcursor;
begin
oldcur := Screen.Cursor;
screen.cursor := crHourGlass;
try
if CurADODS.Active = true then CurADODS.Close;
CurADODS.CommandText := SSql;
CurADODS.Open;
finally
screen.Cursor := oldcur;
end;
end;
导出:
begin
SaveDialog2.DefaultExt := 'xml';
SaveDialog2.Filter := '通用文档数据库|*.xml';
end
if SaveDialog2.Execute then
begin
exportfilename := SaveDialog2.FileName;
end;
if exportfilename <> '' then
begin
ssql := 'select room into rooms in ' + '''' + exportfilename + '''' + ' from rooms';
dm1.ADOCommand1.CommandText := ssql;
dm1.ADOCommand1.Execute;
导入:
ssql := 'select room from rooms';
if OpenDialog1.Execute then
begin
exportfilename := OpenDialog1.FileName;
end;
doadosql(dm1.ADOexport, ssql);
dm1.ADOexport.LoadFromFile(exportfilename);
dm1.ADOexport.UpdateBatch(arAll);
MessageDlg('数据导入成功!', mtInformation,
[mbOk], 0);