ado|stream| Client | data | database
This is an example of data from the server database directly to the client file, and the filename and extension can be written casually as needed. New/temp.htm requires real existence, in fact, does not have any effect, just guide, otherwise can not stram data write operation.
There are a lot of things that are circulating on the Internet, but most of them are copy, and it's very simple to make things so complicated. The things that really go through practice are so few and pitiful. So I wrote a, although simple, there are some problems, but copy down can be used. Friends with problems can contact me to study 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 (&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