1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Public Sub SaveDS(ByVal ds As DataSet)
Dim lFullName As String
lFullName = nom_de_ton_fichier
Dim sw As StringWriter = New StringWriter
Dim serializer As New XmlSerializer(GetType(DataSet))
serializer.Serialize(sw, ds)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.ContentType = "text/plain"
HttpContext.Current.Response.Charset = ""
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" & lFullName)
HttpContext.Current.Response.Write(sw.ToString())
HttpContext.Current.Response.End()
End Sub |
Partager