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();
}
}
查看全文
相关阅读:
Python踩坑总结
you-get下载酷我音乐付费歌曲
Windows下python2和python3共存时pip失效(pip找不到)的解决办法
正负混合排序,正数在前,负数在后
用Python做窗口化滚动点名系统
sublime3自定义快捷键运行python,支持input()函数
python中字典,没键加键,有键操作其键对应的值,的思想
python可变容器类型做函数参数的坑
Ascii码 unicode码 utf-8编码 gbk编码的区别
python文件操作各种模式和常用方法总结r r+ rb r+b
原文地址:https://www.cnblogs.com/cl1024cl/p/6204991.html
最新文章
Java [Leetcode 189]Rotate Array
Java [Leetcode 168]Excel Sheet Column Title
Java [Leetcode 155]Min Stack
机器学习算法
D365 FO第三方集成(二)---访问认证(获取访问令牌)
D365 FO第三方集成(一)---访问认证(应用注册)
AX2012改变窗体状态栏背景色
D365FO表慎重更改字段类型
D365 FO最佳实践BP(七)-构造函数应该Protected
How to using x++ code create GL journal[AX2012]
热门文章
How to executing direct SQL statements [Axapta, AX4.0, AX2009, AX2012]
How to using T-SQL statement copy table[SQL]
How to move the user document folder to D disk[Windows 7]
How to setup and process Intercompany accounting [AX2012]
How to display SSRS report based on customer/Vendor specific language [AX2012]
How to get the underlying SSRS Report Query, reset query , add your own ranges and execute report [AX2012]
How to understand ReferenceGroup control on Form[AX2012]
How to using x++ creating Vendors [AX2012]
How to running Job from a Form
使用JiaJa2通过模板生成文本文件
Copyright © 2011-2022 走看看