社区
VB基础类
帖子详情
如何显示SQL SERVER中的图像
WUNEN
2008-03-25 09:37:43
图像字段为:CARPHOTO
取ID字段的值直接用rs("ID")即可,请问如何把CARPHOTO字段中的图像读出来放到Picture1中,先谢谢
...全文
136
6
打赏
收藏
如何显示SQL SERVER中的图像
图像字段为:CARPHOTO 取ID字段的值直接用rs("ID")即可,请问如何把CARPHOTO字段中的图像读出来放到Picture1中,先谢谢
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
WUNEN
2008-03-25
打赏
举报
回复
问题解决,结贴
WUNEN
2008-03-25
打赏
举报
回复
TO 2楼,图片有什么办法可压缩一下?太大了,因为我还要对它加字上去呢
WUNEN
2008-03-25
打赏
举报
回复
放心吧,只要解决问题,分是小事,先谢了
程序员老干部
2008-03-25
打赏
举报
回复
记得给分,吼吼
程序员老干部
2008-03-25
打赏
举报
回复
读取的
Private Sub ReadFromDB(RY As String)
Dim Rst As New ADODB.Recordset
Dim Mstream As ADODB.Stream
Dim SQL As String
On Error Resume Next
SQL = "select * from ry_manage where rybh='" & RY & "'"
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If IsNull(Rst.Fields("pic")) Then img.Picture = LoadPicture(): Exit Sub
If Rst.RecordCount = 0 Then
ShowMsg 1, " 数据库出错,请与系统管理员联系!"
Rst.Close
Set Rst = Nothing
Exit Sub
End If
Set Mstream = New ADODB.Stream
Mstream.Type = adTypeBinary
Mstream.Open
Mstream.Write Rst.Fields("pic").Value
Mstream.SaveToFile App.Path & "\tmpImage.gif", adSaveCreateOverWrite
Mstream.Close
Set Mstream = Nothing
img.Picture = LoadPicture(App.Path & "\tmpImage.gif")
End Sub
保存的
Private Sub SaveToDB(RY As String)
Dim Rst As New ADODB.Recordset
Dim Mstream As New ADODB.Stream
Dim SQL As String
Dim MediaName As String
MediaName = Trim$(PicFileName)
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select * from ry_manage where rybh='" & RY & "'"
Rst.Open SQL, Conn, adOpenStatic, adLockPessimistic, adCmdText
Set Mstream = New ADODB.Stream
Mstream.Type = adTypeBinary
Mstream.Open
Mstream.LoadFromFile PicFileName
Rst.Fields("Pic").Value = Mstream.Read
Rst.Update
Rst.Close
Set Rst = Nothing
Set Mstream = Nothing
End Sub
Tiger_Zhao
2008-03-25
打赏
举报
回复
用 rs("CARPHOTO").GetChunk 取得二进制数据,具体调用参考 MSDN。
如果二进制内容就是图片内容,那么存成文件,LoadPicture就可以了;如果是其它格式就要根据格式进行处理了。
将
SQL
server
2000
中
保存的
图像
显示
在Picture
中
//将
SQL
server
2000
中
保存的
图像
显示
在Picture
中
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
byte[] buffByte = null;
string comm = @"select img from table1 where id = " + this.listBox1.SelectedValue
C# 保存
图像
文件到
SQL
SERVER
数据库,再读取该文件并
显示
需要在
SQL
SERVER
中
创建数据库test, 然后再test
中
创建一个数据表ImageTable,含字段 id int 自动增长ImagePath nchar(50)Image image类型代码如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.D
asp.net c#读取
sql
server
图像
字段
在ASP
中
,我们用Request.TotalBytes、Request.BinaryRead()来上传图片,这个可恶的BinaryRead()方法非常笨,单个文件上传倒没什么大事,单如果多个图片上专可就花大气力了…!而现在ASP.Net
中
将会把解决以前ASP
中
文件上传的种种问题,使你在ASP.Net
中
轻轻松松开发出功能强大的上传程序...首先在
SQL
Server
中
建立一个图片存储的数库
sql
2012 ssrs_使用SSRS查看
SQL
Server
FILESTREAM数据
sql
2012 ssrs 进出口业务 (Importing and exporting)
SQL
Server
FILESTREAM stores objects into the file system and applications can retrieve these objects to benefit from the IO streaming capability of th...
vb.net+
SQL
Server
读写图片
''' ''' 向数据库写入image类型数据 ''' ''' ''' ''' Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim conStr As S
VB基础类
7,788
社区成员
197,583
社区内容
发帖
与我相关
我的任务
VB基础类
VB 基础类
复制链接
扫一扫
分享
社区描述
VB 基础类
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章