参阅 ADO 数据库对象。
set cn = server.CreateObject("ADODB.connection")
set rec = server.CreateObject("ADODB.Recordset") cn.open "driver={microsoft access driver (*.mdb)};uid=tc;pwd=;dbq=" & "DATA.MDB" rec.open "select * from table where id=" & cint(id) , cn 显示数据部分 rec.close cn.close |
response.write rec.fields("column").value |
一般此数据单独输出,若为图象,用法示例:<IMG src="getimage.asp?id=1">
data = rec.fields("image").value
Response.ContentType = rec.fields("filetype").value Response.AddHeader "Content-Disposition","inline; filename=""" + rec("filename") + """" Response.AddHeader "Content-Disposition","attachment; filename=""" + rec("filename") + """" Response.BinaryWrite data |
参数 | 说明 |
---|---|
inline | 在浏览器打开 |
attachment | 提示保存 |
ContentType | 文件类型说明,例 "image/pjpeg" |