zoukankan
html css js c++ java
ASP.net对SQL server数据库里取image类型怎么取
Q:
对SQL server数据库里取image类型怎么取???
A:把aspx的html元素去掉,然后页面中调用以下函数。这个页面返回的就是图片
private
void
DownloadImage(
string
FileID)
...
{
using
(System.Data.SqlClient.SqlConnection conn
=
new
System.Data.SqlClient.SqlConnection())
...
{
conn.ConnectionString
=
"
.....
"
;
conn.Open();
using
(System.Data.SqlClient.SqlCommand command
=
conn.CreateCommand())
...
{
command.CommandText
=
string
.Format(
"
select ImageSize,Image from tablexxx where id='{0}'
"
, FileID);
System.Data.SqlClient.SqlDataReader reader
=
command.ExecuteReader();
try
...
{
if
(reader.Read())
...
{
int
size
=
reader.GetInt32(
0
);
byte
[] buffer
=
new
byte
[size];
reader.GetBytes(
1
,
0
,buffer,
0
,size);
this
.Response.BinaryWrite(buffer);
}
}
catch
(Exception ex)
...
{
this
.Response.Write(ex.Message);
}
finally
...
{
reader.Close();
}
}
conn.Close();
}
}
查看全文
相关阅读:
[VueJS + Typescript] Decouple Dependencies Using IoC Containers in Vue with TypeScript and InversifyJS
便利店选址
spoj 1811 Longest Common Substring (后缀自动机)
sharepoint 2013 根据网站模版创建网站,并赋值网站权限 create a site by custom site template
一则 ORA-00471 处理方法
好端端的项目重新运行的时候却不行了!!!
C语言指针和数组知识总结(下)
Java EE登陆界面生成随机数防止恶意注册或者登录
ASP.NET获取上传图片的大小
Not able to reset SmartRF04DD
原文地址:https://www.cnblogs.com/cl1024cl/p/6204991.html
最新文章
Web前端--黑客技术揭秘(菜鸟知识)
《医院浮世绘》:心外科医生写的医院与医疗界趣闻轶事。三星推荐
《战略调色板》:《经济学人》管理专栏文章合集第3辑,四星推荐。
《医改,就该这么改》:印度一些医院的惊人创新:医疗技术世界一流,收费相对低廉。五星推荐
《未来医疗》:对未来医疗技术与医疗商业模式的畅想:诊断与治疗将更加便捷,病人将会有更多的自主权。三星推荐
《掌舵2》:地产商上市波折。三星推荐。严重剧透。
《掌舵》:二十年前房地产商发迹与商战史。三星推荐。严重剧透。
《哲王》:《经济学人》管理专栏文集第二辑,五星推荐
《楚墓》:穿插讲现代学者和古代巫师的故事,二星
《互联网+医疗:重构医疗生态》,第四章介绍美国的医药福利管理制度与企业,值得看看,其他章节一般。总体二星。
热门文章
《零售心理战》:711董事长总结的运营经验。三星推荐
[AngularJS] Store the entry url and redirect to entry url after Logged in
[React] Use Prop Collections with Render Props
[TypeScript] Loading Compiled TypeScript Files in Browser with SystemJS
[Spring] Properties for project configuration
[Spring] Bean Scope Singleton cs Prototype
[React] Prevent Unnecessary Rerenders of Compound Components using React Context
[React] Validate Compound Component Context Consumers
[AngularJS] ocLazyLoad -- Lazy loaded module should contain all the dependencies code
[Angular] 'providedIn' for service
Copyright © 2011-2022 走看看