Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert Null value to the Integer Column

Through the front end I want to insert NULL value to the Column whose DataType is Int.

I used like this:

POP.JobOrderID = Convert.ToInt32(DBNull.Value);

But I cannot Insert Null value, it throws error such as "Object cannot be cast from DBNull to other types":

How to insert NULL values?

like image 737
thevan Avatar asked Jun 25 '11 14:06

thevan


1 Answers

if you wish to do it POP.JobOrderID should be type int? (nullable int) not int

like image 106
kleinohad Avatar answered Sep 29 '22 03:09

kleinohad