如何保存和回收PictureBox图像到Sql Server数据库Varbinary(Max)列VB.NET [英] How to save and Retrive PictureBox Image to Sql Server Database Varbinary(Max) Column VB.NET

查看:80
本文介绍了如何保存和回收PictureBox图像到Sql Server数据库Varbinary(Max)列VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



在我的Windows应用程序中,我必须在Windows Form PictureBox中显示图像,该图像将由OpenFile Dialog浏览,然后将PictureBox图像保存到Sql使用VB.NET 2010将Server 2008 R2 Varbinary(Max)列和显示图片保存在Sql Server 2008 R2 Varbinary(Max)列到PictureBox中。





我使用以下代码将图片从物理驱动器加载到PictureBox



Dear Friends,

In my windows application I have to display image in Windows Form PictureBox which will be browsed by OpenFile Dialog, and then save PictureBox image to Sql Server 2008 R2 Varbinary(Max) Column and Show Picture saved in Sql Server 2008 R2 Varbinary(Max) column to PictureBox Using VB.NET 2010.


I have used the following code to load Picture from physical drive to PictureBox

Private Sub btnPicBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPicBrowse.Click
        With Me.OpenFileDialog1
            .FileName = ""
            .Filter = "Image Files(*.BMP;*.JPG;*.JEPG;*.GIF)|*.BMP;*.JPG;*.JEPG;*.GIF|All files (*.*)|*.*"
            .RestoreDirectory = True
            .ValidateNames = True
            .CheckFileExists = True
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.PictureBox1.Image.Dispose()
                Me.PictureBox1.Image = System.Drawing.Image.FromFile(.FileName)
                Me.lblPicPath.Text = .FileName
            End If
        End With
    End Sub





现在我必须将此图像保存到SQL SERVER 2008 Da tabase VarBinary(MAX)Column然后使用VB.NET 2010将保存在Sql Server 2008 R2 Varbinary(Max)列中的图片保存到PictureBox。



谢谢&问候



JYOTIRMOY



Now I have to save this Image to SQL SERVER 2008 Database VarBinary (MAX) Column and Then Show Picture saved in Sql Server 2008 R2 Varbinary(Max) column to PictureBox Using VB.NET 2010.

Thanks & Regards

JYOTIRMOY

推荐答案

老实说,回答这么多次问题并不好然后再次。请看这里:

http://www.codeproject.com/search.aspx?doctypeid=5&q=database+%28image+OR+picture%29+%28store+OR+get+OR+检索%29 [ ^ ],



http://www.codeproject .com / search.aspx?doctypeid = 5& q =数据库+%28image + OR +图片%29 +%28store + OR +获取+ OR +检索%29 + PictureBox [ ^ ]。



-SA
Honestly, this is not good to answer the question asked so many times again and again. Just look here:
http://www.codeproject.com/search.aspx?doctypeid=5&q=database+%28image+OR+picture%29+%28store+OR+get+OR+retrieve%29[^],
or
http://www.codeproject.com/search.aspx?doctypeid=5&q=database+%28image+OR+picture%29+%28store+OR+get+OR+retrieve%29+PictureBox[^].

—SA


这篇关于如何保存和回收PictureBox图像到Sql Server数据库Varbinary(Max)列VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆