Skip to content
Advertisement

C# Error : Unable to insert record in SQL

Please pardon my knowledge on C# as I am very new to it,I am unable to insert a record in SQL and getting the below error while insert image to SQL. Error :

Object reference not set to an instance of an object.

If i select a image and insert it inserts successfully, but if i do not select an image it throws the above error. Please help!!

Advertisement

Answer

Try testing that PictureBox1.Image exists before referencing it, like this:

EDITED to include comment by GarethD

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement