My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Imports System.Data.SqlClient

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub btnEnviar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEnviar.Click
Dim conexao As New SqlConnection(ConfigurationManager.ConnectionStrings("SqlConnectionStringSqlServer").ConnectionString)
Try
conexao.Open()
Dim comando As New SqlCommand("INSERT INTO [DotNet_Gravar_e_Ler_Imagem_no_Banco_de_dados] (Imagem) VALUES (@Imagem) ", conexao)
comando.Parameters.Add("@Imagem", Data.SqlDbType.Image).Value = FileUploadImagem.FileBytes ' O "FileUploadImagem" é a ID do controle FileUpload
comando.ExecuteNonQuery()
GridView1.DataBind()
Finally
conexao.Close()
End Try
End Sub

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
ScriptManager.RegisterStartupScript(Page, Page.GetType, "script_popup_imagem", String.Concat("window.open('", ResolveUrl("~/GerarImagem.ashx?id="), GridView1.SelectedValue, "', 'Imagem', 'width=800, height=600')"), True)
End Sub

End Class

Change log

d844e23324d1 by yccodigo on May 2, 2010   Diff
a
Go to: 
Project members, sign in to write a code review

Older revisions

486809c61d4f by yccodigo on May 1, 2010   Diff
1
All revisions of this file

File info

Size: 1227 bytes, 23 lines
Powered by Google Project Hosting