My favorites
▼
|
Sign in
yccodigo
yccodigo
Project Home
Downloads
Wiki
Issues
Source
Repository:
default
wiki
Checkout
Browse
Changes
Clones
Source path:
hg
/
DotNet_Gravar_e_Ler_Imagem_no_Banco_de_dados
/
VB.Net_Gravar_e_Ler_Imagem_Banco_de_dados
/
GerarImagem.ashx
9e0e8a2db6b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<%@ WebHandler Language="VB" Class="GerarImagem" %>
Imports System
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data
Public Class GerarImagem : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
If String.IsNullOrEmpty(context.Request.QueryString("id")) Then
context.Response.ContentType = "text/plain"
context.Response.Write("Está faltando a querystring id.")
Else
context.Response.ContentType = "image/jpg"
Dim conexao As New SqlConnection(ConfigurationManager.ConnectionStrings("SqlConnectionStringSqlServer").ConnectionString)
Try
conexao.Open()
Dim comando As New SqlCommand("SELECT Imagem FROM DotNet_Gravar_e_Ler_Imagem_no_Banco_de_dados WHERE IDImagem = @IDImagem", conexao)
comando.CommandType = CommandType.Text
comando.Parameters.Add("@IDImagem", SqlDbType.Int).Value = context.Request.QueryString("id")
context.Response.Clear()
context.Response.BinaryWrite(comando.ExecuteScalar)
Catch ex As Exception
Finally
conexao.Close()
End Try
End If
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
Show details
Hide details
Change log
62f9ba5e96c5
by yccodigo on May 2, 2010
Diff
a
Go to:
..._Banco_de_dados/GerarImagem.ashx
..._de_dados/Imagem/ImgGridview.png
..._Imagem_no_Banco_de_dados/README
...gem_no_Banco_de_dados/README.txt
..._Banco_de_dados/GerarImagem.ashx
..._de_dados/Imagem/ImgGridview.png
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1519 bytes, 38 lines
View raw file
Powered by
Google Project Hosting