Foros del Web » Programando para Internet » ASP Clásico »

Guardar en un txt

Estas en el tema de Guardar en un txt en el foro de ASP Clásico en Foros del Web. Bueno tengo una pregunta, hago una conección a la BD y el resulatdo quiero que me lo guarde en un txt, cómo lo hago?? Gracias ...
  #1 (permalink)  
Antiguo 06/03/2002, 15:51
Avatar de mamon  
Fecha de Ingreso: enero-2002
Ubicación: Lima
Mensajes: 1.302
Antigüedad: 23 años, 3 meses
Puntos: 3
Guardar en un txt

Bueno tengo una pregunta, hago una conección a la BD y el resulatdo quiero que me lo guarde en un txt, cómo lo hago??

Gracias de Antemano

Giancarlo Loret de Mola (Mamon)
  #2 (permalink)  
Antiguo 06/03/2002, 22:37
Avatar de wamoretti  
Fecha de Ingreso: febrero-2002
Ubicación: Lima
Mensajes: 34
Antigüedad: 23 años, 2 meses
Puntos: 0
Re: Guardar en un txt

Set Rs = Cn.Execute("select * from TuTabla")
archivo = Server.MapPath("Archivos.txt")
Set fstemp = Server.CreateObject("Scripting.FileSystemObje ct")
Set filetemp= fstemp.CreateTextFile(archivo, True, False)
contador= Rs.Fields.Count-1
For i = 0 to Contador
Cabecera = Cabecera & Rs(i).Name & " "
Next
filetemp.Write Cabecera & vbCrLf
Do Until Rs.EOF
For i = 0 To Contador
If IsNull(Rs(i)) then
texto = texto & "" & Chr(9)
Else
texto = texto & Rs(i) & Chr(9)
End If
Next
filetemp.Writeline texto
texto = ""
Rs.MoveNext
Loop
filetemp.close
Set filetemp = Nothing
Set fstemp = Nothing
Set Rs = Nothing
%>

El chr(9) es igual a usar un TAB, osea que te separa los campos con una tabulacion

Espero te sirva el ejemplo

<OBJECT WIDTH=200 HEIGHT=50><PARAM NAME=movie VALUE="http://www.geocities.com/wamoretti/wamoretti.swf"><PARAM NAME=wmode VALUE=transparent><EMBED src="http://www.geocities.com/wamoretti/wamoretti.swf" wmode=transparent WIDTH=200 HEIGHT=50></EMBED></OBJECT
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:42.