如何在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