Practice about writing database data to client files about AdoDb.Stream

xiaoxiao2021-03-06  80

Practice by writing database data from Adodb.Stream to client files:

http://blog.9cbs.net/swelltan/

This is an example, file name, and extension of data directly from the server database to the client file, can be written as needed. New / temp.htm requires true existence, in fact, there is no effect, just guiding, otherwise it is not possible to write the STRAM data.

There are a lot of things in this area, but most of them are Copy, very simple things are so complicated. Really practical Dongdong is very poor. So I wrote one, although it is simple, some problems, but COPY can be used. Friends having problems can contact me, so learn together.

FilemyStream = Server.Mappath ("New") & "/temp.htm"

SET MyStream = Server.createObject ("AdoDb.Stream")

MyStream.Type = 1

MyStream.Mode = 3

MyStream.open

MyStream.LoadFromfile (FilemyStream)

Response.contentType = "Application / OcTet-stream"

Response.addheader "Content-Disposition:", "Attachment; FileName =" & "bk.txt"

Range = MID (Request.ServerVariables ("http_range"), 7)

Response.write "Name"

Response.write "account"

Response.write "Address"

Response.write "Description"

Cr = CHR (13) & chr (10)

Response.write (CR)

While Not Rs.eof

Response.write RS ("Name")

Response.write RS ("accno")

Response.write RS ("Address")

Response.write RS ("Note")

Response.write (CR)

Rs.movenext

Wend

Rs.close

SET RS = Nothing

Conn.close

Set conn = Nothing

MyStream.Close

Set mystream = Nothing

转载请注明原文地址:https://www.9cbs.com/read-94509.html

New Post(0)