Why is it that this code, directly from the LR, results in a “Cannot assign a value to this property” compiler error in Xojo 2014r1?
// rs is a RecordSet with a BLOB column called "FileData":
rs.Edit
Dim data As String
data = GetDataFromFile // Load the binary data for a file
// The following line causes the error:
rs.Field("FileData").NativeValue = data
rs.Update
If I change NativeValue to StringValue or Value, the compiler is happy. I’m using this for a Blob column that holds JPEG picture data, which is why I’m trying to use NativeValue.
Well, Peter, this is a really good catch! Use Value (or StringValue) in this case. NativeValue is supposed to be read-only.
The docs appear to have been wrong since the beginning. I just checked the 2007 printed copy I have here and they are wrong then!
I’ll get this updated.
I’ve updated the LR. Thanks again for catching this, Peter!
Thanks for the quick response. Out of curiosity, why is this one value property read-only? Also, the LR seems to suggest that using NativeValue will avoid any issues related to encodings messing up the data. Given my JPEG image data, do I need to do anything to prevent this if I use StringValue or simply Value?
I’m not sure anyone would know at this point.
I checked with William and Value/StringValue will not add an encoding to binary data.