Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2006, 17:12
marko249
 
Fecha de Ingreso: septiembre-2004
Mensajes: 179
Antigüedad: 19 años, 8 meses
Puntos: 0
generar varios txt desde

Hola a todos


Tengo otor problema y es que necesio generar varios archivos txt desde una misma ejecucion y no he podico saber como hacer que funcione el siguiente es mi codigo


Tamano = 0
dato2 = 5
dato3 = 2
dato4 = (dato2 / dato3)
While Tamano <= dato4
writer.AutoFlush = True
'/////////////////////////////////////////////////////////////////////////////
'cabecera
'////////////////////////////////////////////////////////////////////////////
writer.Write("<?xml version=""1.0"" encoding=""ISO-8859-1""?>")
writer.Write("<mas xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""")
writer.Write(" xsi:noNamespaceSchemaLocation=""../xsd/1002.xsd"">")
writer.Write(" <Cab> ")
writer.WriteLine("<Ano>" & fecha1 & "</Ano>")
writer.WriteLine(" <CodCpt> " & LBConcepto.SelectedValue & " </CodCpt> ")
writer.WriteLine(" <Formato> " & CBFormato.SelectedValue & " </Formato> ")
writer.WriteLine(" <Version>6</Version> ")
writer.WriteLine(" <NumEnvio> 1 </NumEnvio> ")
writer.WriteLine(" <FecEnvio> " & Format(Now, "yyyy-MM-dd hh:mm:ss") & " </FecEnvio> ")
writer.WriteLine(" <FecInicial> " & TxtFecha.Text & " </FecInicial> ")
writer.WriteLine(" <FecFinal> 2005-01-01 </FecFinal> ")
writer.WriteLine(" <ValorTotal> 140200 </ValorTotal> ")
writer.WriteLine(" <CantReg> 2 </CantReg> ")
writer.WriteLine("</Cab>")


'////////////////////////////////////////////////////////////////////
Cant = 1
'Cuerpo del Reporte


For T = Cant To (T + 2)
writer.WriteLine("<rets item=""" & T & """ feclip=""" & conn.State & """ dato4=""" & dato4 & """ /> ")
'nman='numman' facman='fechMan' doccons='DucCon' fecdoc='FecDoc' doctrans='Trans' fectrans='Fecha' apl1='apl' apl2='ap2' nom1='nom1' nom2='nom2' rsoc='Razso' dir='direc' dpto='Dpto' apl2='ap2' mun='Mun' desc='Desc' subpar='subpar' tcamb='TasaC' vrfob='FOB' vrflet='Flete' vseg='Seguros' vrad='Rad' tarar='Arancel' bgar='Base1' tpar='Total Arancel' tariva='Iva' tarotr='Tarifa O' bgotr='Base O' tpotr='TPagarO' total='toatl' /> ")

Next
Cant = T


Response.Clear()
writer.WriteLine("</mas>")
' En la respuesta http adicionar los encabezados que describen la información de archivo

' El contenido es un archivo llamado documento.txt de tipo attachment
NombArc = LBConcepto.SelectedValue & CBFormato.SelectedValue & "1" & fecha1 & Tamano & "Concecutivo.xml"
nombre = NombArc
Response.AppendHeader("Content-Disposition", "attachment; filename=" & NombArc & "")

' La longitud del contenido es del tamano de la longitud del Stream (Nuestro documento)
Response.AppendHeader("Content-Length", mystream.Length.ToString())



Tamano = Tamano + 1

End While
' Se define el tipo de contenido
Response.ContentType = "application/octet-stream"

' Se escribe la cadena de caracteres binarios al output Stream HTTP
Response.BinaryWrite(mystream.ToArray())
' Se envía el buffer actual al usuario. En este caso el documento
Response.End()




pero cuando ejecuto el programa solo genrea un solo archivo desopues de salir del ciclo

Alguien puede decirme que esta mal

Les agradezco