How to set parameters for stored proc in nlog

23 views
Skip to first unread message

Mike Rutledge

unread,
May 9, 2016, 11:54:29 AM5/9/16
to NLog-Users
I'm totally new to this and probably doing it incorrectly. Can someone explain how, in my c# code, do I set the values for the parameters to send to the stored proc?

Below is what my nLog.config file looks like.  I'm assuming somewhere in code I can set these parameter values but I don't see how.

<target xsi:type="Database"
          dbProvider="System.Data.SqlClient"
          connectionStringName="nLogConnectionString"
          keepConnection="false"
          dbDatabase="interface"
          commandType="StoredProcedure"
          commandText=" exec usp_LogParserMessage @Message,@Parser,@Org,@LabOrg,@ChartNum,@AccessionId,@Status,@TransId">
        <parameter name="@Message" layout="${message}"/>
        <parameter name="@Parser" layout="${Parser}"/>
        <parameter name="@Org" layout="${Org}"/>
        <parameter name="@LabOrg" layout="${LabOrg}"/>
        <parameter name="@ChartNum" layout="${ChartNum}"/>
        <parameter name="@AccessionId" layout="${AccessionId}"/>
        <parameter name="@Status" layout="${Status}"/>
        <parameter name="@TransId" layout="${TransId}" />
      </target>


I would appreciate any help. 

Thanks,
Rut
Reply all
Reply to author
Forward
0 new messages