如何从Windows窗体中保存MS Access数据库中的图像 [英] How to save image in MS Access database from Windows Form

查看:117
本文介绍了如何从Windows窗体中保存MS Access数据库中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的窗口应用程序中有一个名为Frm_Client的Windows窗体。我想为每个客户端保存照片。有三个按钮可以更改照片,删除照片和保存照片。我不知道如何执行这在VB 2008和后端的MS Access数据库
,我在TableAdapters上使用SQL查询执行插入,更新和删除。请尽快回复。

解决方案


将图像保存到MemoryStream中,将其转换为字节数组并将这些字节保存到表中的approriate字段中(在访问时 - 在至少在早期 - 你可以将它保存到类型为"OleObject"(或左右)的字段中。例如OleDBParameters的
代码中的OleDbType.VarBinary。


问候,


 的Thorsten


I have one Windows Form named Frm_Client in my Window Form Application.I want to save photograph for each client.There are three buttons to change photo,remove photo and save photo.I don't know how to perform this in VB 2008 and MS Access database at backend and I am using SQL Queries on TableAdapters to perform Insert,Update and Delete .Please reply ASAP.

解决方案

Hi,

save the image into a MemoryStream, convert this to a byte array and save these bytes into an approriate field in the table (in access - at least in earlier times - you could save it to a field of type "OleObject" (or so). OleDbType.VarBinary in code for eg the OleDBParameters ).

Regards,

  Thorsten


这篇关于如何从Windows窗体中保存MS Access数据库中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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