请教:读取数据库,显示附件问题
代码不执行,没有错误显示。请教高手!
Dim sql, strfilename As String
cn.Open()
sql = "SELECT * FROM " & Request.QueryString("tbl") & " WHERE ID=" & Request.QueryString("id")
Dim dr_read As SqlDataReader
Dim oCommand As New SqlCommand(sql, cn)
dr_read = oCommand.ExecuteReader()
If dr_read.Read() Then
Response.Clear()
strfilename = dr_read("FILENAME")
Response.AddHeader("Content-Disposition", "inline;filename=" + HttpUtility.UrlEncode(strfilename, Encoding.UTF8))
Response.AddHeader("Content-Length", dr_read("FILELENGTH"))
Response.AddHeader("Content-Type", dr_read("FILEFMT"))
Response.OutputStream.Write(CType(dr_read("FILEDATA"), Byte()), 0, dr_read("FILELENGTH"))
End If
dr_read.Close()
cn.Close()
Response.End()
------解决方案--------------------表示问题没有描述清楚
“显示附件问题”?
Response.AddHeader("Content-Disposition", "inline;filename=" + HttpUtility.UrlEncode(strfilename, Encoding.UTF8)) 这里报错?
先断点检查下问题的地方吧