I'm getting values from database to a aspx page. while getting values of one column, the column is throwing a value like...
null,402,2912,2909,2910,2913,2911,2914,2915,2388,2389,2390,
2391,2964,2965,2392,2393,2394,2395,2397
Now it throws a exception
Conversion failed when converting the varchar value 'null' to data type int.
But I want all the other values of the column except the null...
Is there any way to convert this 'null' to '0', but still all the other values should exist.
Make your data type Nullable<int> instead of int to allow the converted int nullable values, or on the sql select statement you can do that: ISNULL(yourcolumn, 0) to convert null to 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With