如何在C#窗体窗体的ms访问图像值中插入空值? [英] How to insert null value in ms access of image value from C# windows form?

查看:56
本文介绍了如何在C#窗体窗体的ms访问图像值中插入空值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让那个用户选择图像然后在ms访问中插入该图像,如果没有选择则插入空值或其他我不知道的东西。



我尝试过:



i这样做:

i want to make that user select image then insert that image in ms access and if not select then insert null value or something else that i don't know.

What I have tried:

i do this:

if(pb_new.image.toString() == "")
{
   param[0] = new oledbparameter("@Image",oledbtype.varbinary);
   param.value = "" or string.empty() 
}
else
{
   param[0] = new oledbparameter("@Image",oledbtype.varbinary);
   param[0].value = image;
}





有照片框,我给出了名称pb_new,并且有存储图像内存分配和其他东西的图​​像。



there is picturebox which i give name pb_new and there is image which store image memory allocation and other things.

推荐答案

如果我理解你的问题,你应该使用 DBNull.Value Field(System) [ ^ ]



例如

If I understand your question correctly, you should use DBNull.Value Field (System)[^]

For example
param[0].Value = System.DBNull.Value


这篇关于如何在C#窗体窗体的ms访问图像值中插入空值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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