Short Casting Error in C# -
i trying short variables value database , need cast gives casting error @ debugging how can solve problem ?can me?
obj_objimagegallery.watermark =string.isnullorempty((dr["watermark"]).tostring()) ? null : (short?)(dr["watermark"]);
try this.
short? s = string.isnullorempty((dr["watermark"]).tostring()) ? null : (short?)short.parse(dr["watermark"].tostring());
Comments
Post a Comment