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();
}
}
查看全文
相关阅读:
InfoPath 发布表单到SharePoint库报错
在log4net中控制nhibernate输出
微信扫一扫(wx.scanQRCode)功能新手可能遇到的问题
3.Zookeeper的安装和配置(集群模式)
1.配置HDFS HA (高可用)
2.Zookeeper工作原理(详细)
1.Zookeeper 定义与工作原理
js 获取元素的几种方法
弹出层居中
XUACompatible
原文地址:https://www.cnblogs.com/cl1024cl/p/6204991.html
最新文章
A potentially dangerous Request.Form value was detected from the client
软件开发项目规划时,SA、SD与SE的区别与重要性
TSQL 存储过程: (修订版) 根据基本表结构及其数据生成 INSERT INTO ... 的 SQL (转)
还原数据库相关,孤立用户无法删除,又无法与新建的同名登陆挂钩的解决办法(转)
Windows 2008 64位, WIN7 64位系统,iis7,asp网页访问access数据库报错
安装Django之遇到的问题
python安装xlrd和xlwt两个插件来处理excel问题
linux 关于crontab定时任务配置
python 安装画图工具matplotlib
python2.7安装PyQt4 步骤
热门文章
总结:数列的一些方法
delphi百度网盘上传(支持上传文件、下载文件、获取文件列表、目录创建删除、复制移动文件等操作等)
基于Redisson的延迟队列实现
船舱订票系统测试
电容消耗速度
SharePoint 2013 Workflow Manager 工作流配置注意事项
InfoPath发布到SharePoint Server 2013报错
log4net+spring.net+Nhibernate 内部异常捕捉问题
VMWare host 32位 guest 64位
SharePoint 2013 地址栏_layouts/15/start.aspx#
Copyright © 2011-2022 走看看