null from C# getting converted into 'NULL' in Sql Server
- by Anand
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 ?