Passing DBNull or Decimal value through one method
i'm using , sql stored procedure , command in asp.net app, call method or function value in textbox on page, parse string decimal value , pass on decimal if valid, if null empty didn't populate textbox pass on dbnull.value command parameter , not null. when pass on null command parameter isn't passed when command executed. i'm trying save myself writing bunch of if else statements , call method save me time, there several textboxes need conversion with. appreciated!
michael duhon
if(string.isnullorempty(textbox.text)) command.parameters.addwithvalue("@param", dbnull.value); else command.parameters.addwithvalue("@param", decimal.parse(textbox.text));
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment