//Komut satırından çevirir www.drbob42.com
//geri dönüşüm yoktur
program ADO2CDS;
{$APPTYPE CONSOLE}
uses
SysUtils, ActiveX, ADOdb, Provider, DBClient;
var
ADOTable: TADOTable;
DataSetProvider: TDataSetProvider;
ClientDataSet: TClientDataSet;
Flags: String;
begin
if ParamCount < 1 then
begin
writeln('Usage: ADO2CDS ado.xml [-x]');
writeln;
writeln('Converts ADO.XML to ClientDataSet format')
end
else
try
CoInitialize(nil);
try
ADOTable := TADOTable.Create(nil);
try
ADOTable.LoadFromFile(ParamStr(1));
DataSetProvider := TDataSetProvider.Create(nil);
try
DataSetProvider.DataSet := ADOTable;
ClientDataSet := TClientDataSet.Create(nil);
try
ClientDataSet.SetProvider(DataSetProvider);
ClientDataSet.Open;
Flags := UpperCase(ParamStr(2));
if Pos('X',Flags) > 0 then
ClientDataSet.SaveToFile(ChangeFileExt(ParamStr(1),'.xml'))
else
ClientDataSet.SaveToFile(ChangeFileExt(ParamStr(1),'.cds'))
finally
ClientDataSet.Free
end
finally
DataSetProvider.Free
end
finally
ADOTable.Free
end
finally
CoUninitialize
end
except
writeln('Something went wrong...')
end
end.