You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Coates, Anthony" <an...@anite.com> on 2006/02/28 10:55:55 UTC

Setting AdoNetAppender parameters to null

Hi

I posted this previously in an earlier thread but haven't received a reply
yet so thought I would try it on it's own thread...

 

 

I've been using properties to send several user-defined messages via the
ADO.NET appender. This works great except when I'm trying to set a parameter
value to DBNull.Value (to set the column value that this parameter relates
to to null), e.g. using the command
"log4net.GlobalContext.Properties["Message2"] = DBNull.Value;".

 

In this case the column in the table is being set to an empty string rather
than NULL. This seems to be during the call to AdoNetAppender.SendBuffer
when the actual ado.net parameters value is being set.

 

The config for this parameter is: 

 

<parameter> 

        <parameterName value="@message2" /> 

        <dbType value="string" /> 

        <size value="100"/> 

        <layout type="log4net.Layout.PatternLayout"> 

                <conversionPattern value="%property{Message2}" /> 

        </layout> 

</parameter> 

 

Is it possible to get it to send DBNull.Value instead so the column value
will be set to null? 

 

Thanks 

Ant



Scanned for viruses by BlackSpider MailControl. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.