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
/
CSharp_Gravar_e_Ler_Imagem_Banco_de_dados
/
Default.aspx.cs
‹486809c61d4f
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
using System;
using System.Web.UI;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "script_popup_imagem", string.Concat("window.open('", ResolveUrl("~/GerarImagem.ashx?id="), GridView1.SelectedValue, "', 'Imagem', 'width=800, height=600')"), true);
}
protected void btnEnviar_Click(object sender, EventArgs e)
{
SqlConnection conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlConnectionStringSqlServer"].ConnectionString);
try
{
conexao.Open();
SqlCommand comando = new SqlCommand("INSERT INTO [DotNet_Gravar_e_Ler_Imagem_no_Banco_de_dados] (Imagem) VALUES (@Imagem) ", conexao);
comando.Parameters.Add("@Imagem", SqlDbType.Image).Value = FileUploadImagem.FileBytes; // O "FileUploadImagem" é a ID do controle FileUpload
comando.ExecuteNonQuery();
GridView1.DataBind();
}
finally
{
conexao.Close();
}
}
}
Show details
Hide details
Change log
d844e23324d1
by yccodigo on May 2, 2010
Diff
a
Go to:
...agem_Banco_de_dados/Default.aspx
...m_Banco_de_dados/Default.aspx.cs
...Imagem_Banco_de_dados/web.config
...Ler_Imagem_no_Banco_de_dados.sln
...Ler_Imagem_no_Banco_de_dados.suo
...anco_de_dados/TabelasDoBanco.sql
...agem_Banco_de_dados/Default.aspx
...m_Banco_de_dados/Default.aspx.vb
...Imagem_Banco_de_dados/web.config
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: 1236 bytes, 29 lines
View raw file
Powered by
Google Project Hosting