I am using NLog to log in my application and as part of that we are logging the customer number, which is a string in C#, and a varbinary(32) in the database. I am using the following SQL code for this specific parameter. The rest of the SQL statement works fine:
CONVERT(varbinary(32), @CustNumber)
and the following NLog parameter:
<parameter name="@CustNumber" layout="${event-context:item=CustNumber}" />
and the following code in C# to add the Nlog parameter:
myEvent.Properties.Add("CustNumber", custNumber);
For some reason the value being stored in the actual table is only the first character of the original Customer Number string. I have double and triple checked to make sure I am not truncating the string before it is sent to the database. Any help would be greatly appreciated.