Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > MS SQL Server
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 02-08-2005
YaninaGenia YaninaGenia is offline
Miembro
 
Registrado: jun 2005
Ubicación: Buenos Aires
Posts: 95
Poder: 22
YaninaGenia Va por buen camino
Cool Hola

Vas a tener que agregar un componente SaveDialog
Código Delphi [-]
  procedure TForm1.ExportaratxtClick(Sender: TObject);
  var
    archivo : textfile;
    x : string;
    cont : integer;
  begin
    cont := 0;
    if not query1.IsEmpty then
    begin
      try
        savedialog1.DefaultExt := 'cvs';
        savedialog1.Filter := 'Text files (*.cvs)|*.cvs';
        if savedialog1.Execute then
          if savedialog1.FileName <> emptystr then
          begin
            assignfile(archivo,savedialog1.filename);
            rewrite(archivo);
            writeln(archivo,'NOMBRE','APELLIDO','EDAD'); 
  //Aca van tantos nombres como columnas tenga tu consulta, 
  // serán los que aparezcan en el encabezado del CSV.
            query1.First;
            while not (query1.Eof) do
              begin
                x := query1.fieldbyname('NOM').AsString + ';'
                  + query1.fieldbyname('APE').AsString + ';'
                   + query1.fieldbyname('EDAD').AsString; 
 //ACA VAN LOS NOMBRES QUE TIENEN LAS COLUMNAS 
 // EN LA BASE DE DATOS
                writeln(archivo,x);
                query1.Next;
                cont := cont + 1;
              end;
            flush(archivo);
            closefile(archivo);
            showmessage('Total de archivos exportados: '+inttostr(cont));
          end;
        except
          on e : exception do
            showmessage(e.Message);
        end;
    end;
  end;
Cualquier cosa me preguntas.

Yanina Genia

Última edición por Neftali [Germán.Estévez] fecha: 02-08-2005 a las 18:00:13. Razón: cortadas las lineas para que se lea mejor
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 09:08:37.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi