03-10-2014 01:44 AM
How I save a 1D-folat array to MS Sql Server"s image field?
I try.
First all I flat the array.
Then I insert the flated string into the table.It 's OK.
I read it from the table.
There is a error.
The field data is empty.
why?
03-10-2014 03:23 AM - edited 03-10-2014 03:28 AM
from your pictures
your array > string conversion is "big endian,network order" the conversion of the string back into the array is "little endian" - have you checked those? (they should be that same)
James
(edit1 - from the pictures you also never seem to be wiring the flattened array string into the database table so the data is never there to read back anyway!!!)
(edit 2 - you also are reading back an ID which is never inserted into the table so you are expecting the table to be dim1x4 when you write and dim1x5 when you read - you are reading the wrong index!!!)
03-10-2014 04:43 AM
In the upper part of your attached code, you never do anything with the flattened data (all you use is the error output). What is the point of the sequence structure?
03-10-2014 01:03 PM
Image field for a array? Are you talking about blob type (...)? It could be a simple varchar(max)...
Just use the Array to spreadsheet string and insert the array, then retrieve with Spreadsheet string to array. There's no need to flatten the data since it's not a binary type like an image.
03-10-2014 01:10 PM - edited 03-10-2014 01:11 PM
TimeWaveZero wrote:Just use the Array to spreadsheet string and insert the array, then retrieve with Spreadsheet string to array.
This is a lossy conversion that does not allow recovery of the identical DBL array due to limitations in the decimal formatting. Not the same! It is also significantly less efficient.
03-11-2014 12:07 PM
03-11-2014 08:22 PM
thanks you answer
I try it
change the sql server field type from image to varchar(max)
but the data that read from server is empty.
03-12-2014 12:24 AM
LabVIEW already have examples illustrating how to store arrays in BLOB Fields.
Look at the Database Logging (Parametrized).vi and the Playback.vi on the NI Example Finder.