I have been trying to assign/append a string to a blob column in an output buffer, on a C# script that's taking a number of input rows, and concatenating them where the related id is identical, passing onto the next row where the is new, and seem to be coming up against a problem that may be me not knowing the intermediate steps.
I'm using this:
Output0Buffer.compAlert.AddBlobData(Encoding.Unicode.GetBytes(alert),alert.Length);
To assign the alert string to the NTEXT
column compAlert
.
The theory and what I can see from previous answers is that this will add the string alert to said NTEXT
column. The issue I'm coming across is this only adds the first character of that string. As near as I can tell, if GetBytes is fed a string, it should iterate over that string and add everything? I appear to be missing something that all the other answers that say to use Encoding.Unicode.GetBytes()
are taking for granted that I don't know that should be done?
Based on the official documentation, the count
argument in the public void AddBlobData (byte[] data, int count)
method refers to :
The number of bytes of binary data to be appended.
You should use Encoding.Unicode.GetBytes(alert).length
instead of alert.length
.
Output0Buffer.compAlert.AddBlobData(Encoding.Unicode.GetBytes(alert),Encoding.Unicode.GetBytes(alert).Length);
Or simply use:
Output0Buffer.compAlert.AddBlobData(Encoding.Unicode.GetBytes(alert));