1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Response.Clear()
Response.ContentType = "application/octetstream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & Format(Now, "yyyyMMdd-hhmmss") & ".txt")
Response.ContentType = "application/txt"
Response.Flush()
If dtExtract IsNot Nothing AndAlso dtExtract.Rows.Count > 0 Then
For Each oColonne As DataColumn In dtExtract.Columns
Entete &= """" & oColonne.ColumnName & """;"
Next oColonne
Response.Write(Entete & vbCrLf)
'Création des données
For Each oRow As DataRow In dtExtract.Rows
Ligne = Nothing
For i As Integer = 0 To dtExtract.Columns.Count - 1
Ligne &= """" & oRow(i).ToString & """;"
Next i
Response.Write(Ligne & vbCrLf)
Next oRow
dtExtract.Dispose()
Else
Response.Write("aucune données à extraite")
End If
Response.Flush()
Response.End() |
Partager