Click here to Skip to main content
15,907,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;
}


there is picturebox which i give name pb_new and there is image which store image memory allocation and other things.
Posted
Updated 19-Sep-16 4:28am
v3
Comments
[no name] 19-Sep-16 10:20am    
An empty string is not the same as null. And, your code won't compile anyway.
Member 11572517 19-Sep-16 10:21am    
yes, u r right sir, there is error, object reference and ........

what can i do sir for do this.. thank u in advance
[no name] 19-Sep-16 10:30am    
You could try asking questions with all the information necessary to answer the question. And you could also try losing the txtspeak. "u" is a letter of the alphabet, it is not a word used in sentences. "r" is not a work either.
Member 11572517 19-Sep-16 10:35am    
sir, same error, object reference not set to an instance........

1 solution

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

For example
C#
param[0].Value = System.DBNull.Value
 
Share this answer
 
Comments
Member 11572517 19-Sep-16 10:30am    
ok, sir i try.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900