null from C# getting converted into 'NULL' in Sql Server
Posted
by
Anand
on Stack Overflow
See other posts from Stack Overflow
or by Anand
Published on 2014-06-04T09:12:16Z
Indexed on
2014/06/04
9:24 UTC
Read the original article
Hit count: 258
I am trying to insert NULL value in Sql Server if I have null value in corresponding C# String object like below :
String Residence = xmlDoc.Descendants("Appointment").Single().Element("StateOfResidence") == null ? null : xmlDoc.Descendants("Appointment").Elements("StateOfResidence").Single().Value;
I am using Entity framework for Database access. So if Residence is null, 'NULL'
gets inserted into Database instead of NULL. How can insert NULL for null ?
© Stack Overflow or respective owner