Ver Mensaje Individual
  #2  
Antiguo 28-07-2007
Avatar de poliburro
[poliburro] poliburro is offline
Miembro Premium
 
Registrado: ago 2004
Ubicación: México D.F
Posts: 3.068
Reputación: 25
poliburro Va por buen camino
Pero por supuesto, :P, yo trabajo a duiario con Xml :P

Lamentablemente la recuperación del Xml no podrás hacerla desde los componentes ADO que tiene delphi, Deberás Importar el Activex de MDAC para tener acceso a la clase TStream de ADO

Este es un bloque de código de como hacer la recuperación del Xml generado por Sql server

Código Delphi [-]
 
procedure TForm1.Button2Click(Sender: TObject);
Var
  Connection     : ADODB_TLB.TConnection;
  Command        : ADODB_TLB.TCommand;
  Stream         : ADODB_TLB.TStream;
  Records,Params : OleVariant;
  LStlXmlDatos   : TStringList; //Almacena el Xml generado por SqlServer
begin
  Screen.Cursor := crSQLWait;
  Try
    LStlXmlDatos := TStringList.Create;
    ResultMemo.Lines.Text := '';
    Connection := ADODB_TLB.TConnection.Create(Self);
    Connection.Open('Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=AlertaExistencias;Data Source=Servidor',
                    'usaurio','password',0);
    Command := ADODB_TLB.TCommand.Create(Self);
    Command.DefaultInterface.Set_ActiveConnection(
      Connection.DefaultInterface);
    Command.DefaultInterface.CommandType := adCmdText;
    Command.DefaultInterface.CommandText := SQLMemo.Text; //Asigno la consulta

    Stream := ADODB_TLB.TStream.Create(Self);
    Stream.Open(EmptyParam,adModeUnknown,
      adOpenStreamUnspecified,'','');
    Command.DefaultInterface.Properties.Item[
      'Output Stream'].Value := Stream.DefaultInterface;
    Params := EmptyParam;
    Records := Unassigned;
     Command.DefaultInterface.Execute(Records,Params,
      adExecuteStream);
    ResultMemo.Lines.Text :=    Stream.ReadText(Integer(adReadAll));
    Stream.Free;
    Command.Free;
    Connection.Free;
  Finally
    Screen.Cursor := crDefault;
  End;
 If LStlXmlDatos <> Nil Then
   LStlXmlDatos.Free;
end;
__________________
Conoce mi blog http://www.edgartec.com
Responder Con Cita