Hello All,
can anybody tell me what is wrong with this code for c#?
tmp.Mobile2 = reader.IsDBNull(19)? reader.GetString(19) : "";
I'm reading datas from accessDB, want to write -> if value = null (no entered data) then return ""
Or any other solution?
Answers (2)
2
You have the last two arguments of the ternary operator the wrong way around.
It should be:
tmp.Mobile2 = reader.IsDBNull(19) ? "" : reader.GetString(19);
Accepted 0
Its Vice Versa,
tmp.Mobile2 = reader.IsDBNull(19) ? "" : reader.GetString(19);