All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
delphi常用的键盘事件处理方法-实例
Asp.Net,Ajax,学习笔记17,使用Authentication,Service_[Asp.Net教程]
对比两个DataTable是否相同的正确方法_[Asp.Net教程]
详细介绍:Apache+PHP+MySQL配置攻略_[PHP教程]
php脚本中include文件报错解决方法_[PHP教程]
第二篇:使用Visual,Studio,2008进行数据层开发_[Asp.Net教程]
Div布局中如何实现自适应高度_[Html教程]
PHP实例:PHP上传自动生成缩略图及水印类_[PHP教程]
AJAX实例:根据邮编自动完成地址信息_[AJAX教程]
ASP.NET实用技巧(一)_[Asp.Net教程]
Reading number is top 10 pictures
A beautiful girl to bud1
A man's favorite things9
Take you to walk into the most true north Korea rural3
Summer is most suitable for young people to travel in China2
Beautiful Japanese beauty(漂亮的日本美女)3
两张抽象画
NeedWallpaper12
From China fortress sora aoi4
传几朵花
Seductive beauty of crime2
Download software ranking
美女写真3
1400篇各类破解文章
WebService在.NET中的实战应用教学视频 → 第1集
Unix video tutorial3
I'm come from Beijing1
SP4 for SQL2000
都市狐狸姑娘传
WebService在.NET中的实战应用教学视频 → 第3集
Boxer Classic video2
塘西风月痕
delv published in(发表于) 2014/1/10 6:31:57 Edit(编辑)
怎样在vb.net中将图片存入SQL,Server,2000并能读出来使用

怎样在vb.net中将图片存入SQL,Server,2000并能读出来使用

怎样在vb.net中将图片存入SQL Server 2000并能读出来使用?_[Asp.Net教程]

在数据库中建一个Img表,其中包含一个Img字段,类型为Image或Binary
'将Bytes存入数据库
Dim Stream As New IO.MemoryStream
PictureBox1.Image.Save(Stream, System.Drawing.Imaging.ImageFormat.Bmp)
Stream.Flush()
Dim Bytes As Byte() = Stream.ToArray
Dim SQL As String = "insert into Img values (@bytes) "
Dim command As New SqlClient.SqlCommand(SQL, Connection)
command.Parameters.Add("@bytes", SqlDbType.Binary).Value = Bytes
command.ExecuteNonQuery

'读取
Dim Command As New SqlClient.SqlCommand(SQL, Connection)
Dim Reader As SqlClient.SqlDataReader = Command.ExecuteReader()
Dim Bytes as Byte()=Reader.Item("Img")
Dim mStream As New IO.MemoryStream
mStream.Write(Bytes, 0, Bytes.Length)
mStream.Flush()
Dim Img As New Bitmap(mStream)
PictureBox1.Image = Img


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.