hi,
What is your int equivalent to null , I will assume it's 0
com.Parameters.Add("@forwarder", SqlDbType.Int).Value = (
int_var==0)?(object)System.DBNull.Value:(object)in t_var;
Note that you have to cast both parts of ? to object, otherwise you will
get an error, if you do not like to use ? use this
SqlParameter param = com.Parameters.Add("@forwarder", SqlDbType.Int);
if ( int_var==0)
param.Value = System.DBNull.Value
else
param.Value = int_var;
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Paperback Writer" <newsgroupms@gmail.com> wrote in message
news:Obr5wpydFHA.412@tk2msftngp13.phx.gbl...[color=blue]
> Hi All, How are you ?
> I'm trying to insert null values in my database, but these datas are
> datatype Int in my C# and it's converting my null values to 0 (zero)!
> How could i threat that ?
>
> --
> Please, check my theSpoke:
>
http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
>[/color]