assign null value to string in C# and insert SQL Server decimal column that accepts null values
Posted on 2012-12-31
Need some help. This apparently is difficult to do.
I've tried many things which do not work
I'll outlline what I've tried so you don't list it as possible solution.
PROBLEM: I'm trying to assign a null value to a string in C# that already has a value (the reason is for certain conditions to force real NULL value)
Then insert into SQL Server into a column that is decimal format (6,2) and accepts nulls.
When I assign string to = "0" it sends to SQL table but I want actual NULL value to show up. And I've tried "NULL" and that doesn't work because it thinks it's a varchar into numeric(decimal). It's important that the sQL column stays decimal because most of data is decimal format and works, but some cases I need to force an actual NULL value into SQL column. Have tried many suggestions on interent and nothing seems to work.