Ver Mensaje Individual
  #8 (permalink)  
Antiguo 22/08/2003, 04:27
sferrerj
 
Fecha de Ingreso: agosto-2003
Ubicación: Barcelona
Mensajes: 4
Antigüedad: 21 años, 8 meses
Puntos: 0
Prueba con este codigo dentro de un asp

'* Creacion del fichero temporal
Set cnnTest = Server.CreateObject ("adodb.connection")

cnnTest.Open "Cadena de conexion a tu base de datos ODBC"

strSQL = "SELECT CampoNombreCancion,CampoLetra FROM TablaCanciones WHERE campo = valor

Set rsTest = cnnTest.Execute(strSQL)


Dim strOutput

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Fichero = rsTest("CampoNombreCancion") & ".txt"

Set objFile = objFSO.CreateTextFile(strOutput & Fichero)

strLine = strLine & rsTest1("CampoLetra") & VbCrLf



objFile.WriteLine strLine


'* Grabacion en el cliente del fichero
Set objFile = Nothing
Dim strFilePath, strFileName
Const adTypeBinary = 1
strFilePath = strOutput & Fichero
strFileName = Fichero
Response.Clear
dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
ContentType = "application/unknown"
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing