[Solved] How to avoid Tostring exception if string is null? [duplicate]
[ad_1] I guess you are reading from data reader. You will have to check if the value is null or DBNull and then you can call to string method. string user_guid = dr[“user_guid”] != DBNull.Value && dr[“user_guid”] != null ? dr[“user_guid”].ToString() : null ; Hope this helps. [ad_2] solved How to avoid Tostring exception if … Read more