Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4020432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:13:39+00:00 2026-05-20T10:13:39+00:00

I am having a bit of a problem using a stored procedure instead of

  • 0

I am having a bit of a problem using a stored procedure instead of a SQL INSERT statement when using NLog in a C# web application. The connection string “Logger” is correctly configured in Web.config and works properly when replacing the commandText with a SQL statement. I would appreciate a hint in the right direction. In this example the stored procedure is under the “Logs” schema and it is called “LogError”.

<targets>
  <target xsi:type="Database"
      name="dberrorlog"
      connectionStringName="Logger"
      keepConnection="true"   
      commandText="[Logs].[LogError]" >
      <parameter name="@ProgName" layout="MyAppName"/>
      <parameter name="@CompName" layout="${machinename}"/>
      <parameter name="@LogLevel" layout="${level}"/>
      <parameter name="@UserName" layout="${identity}"/>
      <parameter name="@Error" layout="${exception:format=Message}"/>
      <parameter name="@SourceObj" layout="${exception:format=Method}"/>
      <parameter name="@StackTrace" layout="${exception:format=StackTrace}"/>
 </target>
</targets>
<rules>
  <logger name="*" minlevel="Error" writeTo="dberrorlog" />
</rules>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:13:40+00:00Added an answer on May 20, 2026 at 10:13 am

    From this NLog forum post, try using the text to execute the stored procedure:

    commandtext="exec AddActivityLog
                                @ApplicationName, 
                                @ApplicationTime, 
                                @Severity, 
                                @Logger, 
                                @SaxoID, 
                                @EventID, 
                                @Message, 
                                @URL, 
                                @URLReferrer, 
                                @RemoteAddress, 
                                @Callsite, 
                                @CurrentUICulture, 
                                @ThreadIdentity, 
                                @WindowsIdentity, 
                                @MachineName, 
                                @ProcessID, 
                                @ThreadID, 
                                @ThreadName, 
                                @Stacktrace, 
                                @Exception,
                                @Cookie,
                                @FormVariables,
                                @QueryString,
                                @HTTPUserAgent"
    

    Side note: Claus Rathje’s answer wouldn’t render in my browser, so I had to look a the page source to see the configuration he posted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit of a problem. I'm using FireFox 3.6 and have the
I am having a bit of a problem. I get a RAW char* buffer
I'm having a bit of a problem. I have a datatable in the parent
I'm having a bit of a problem with converting the result of a MySQL
I'm having a bit of a problem here. We have 2 urls let me
I'm having a little bit of a problem scaling my images to a properly
I'm having a little bit of trouble understanding what the problem is here. I
I'm using a SELECT statement in T-SQL on a table similar to this: SELECT
I'm having a bit of a problem deciding how to store some data. To
I seem to be having a bit of a TEXT / UNICODE problem when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.