LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a blob of binary data from SQL

I am trying to read a blob of binary data from a MS SQL DB.  The blob data is actually an array of double data.  Every attempt to read the data into LV and use the Variant to datatype subVI always makes it an array of U8 data.  I then need to combine the bytes and convert to double data.  Has anyone ever successfully read a blob directly?  What about an image blob?
 
Attached is my code with the outputs.  It also includes a screen capture of the table structure.
 
John
0 Kudos
Message 1 of 6
(5,792 Views)
You are getting an array of U8 numbers because that it what you are feeding to the Variant to Data -Type input. Right click on the empty array data and select Representation > DBL.






Message Edited by StevenD on 06-16-2008 07:02 PM
0 Kudos
Message 2 of 6
(5,783 Views)
Yes, I tried that and it doesn't work.  The reason I show U8 is because that is the only way it will convert.
 
John
0 Kudos
Message 3 of 6
(5,755 Views)
This could be related to the exact method that you use for inserting the array into the BLOB i the first place. Can we see the code that formats the array for insertion? When inserting a LV datatype, I first flatten it to a string, convert the string to an array of U8s (depending upon the dbms you use this step might not always be necessary) and then insert the array into the BLOB. Coming out then I simply read the BLOB data (which comes back as a string) and unflatten it.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 6
(5,752 Views)

Here is some demo code.  I cannot use more than a 1000 points for a parameterized stored procedure call.  At some level NI must be converting to a string.  The execute mode of calling a stored procedure also fails.

 

Rammer

0 Kudos
Message 5 of 6
(5,561 Views)

The process for saving BLOBs using ADO directly is really very easy - unfortunately the DCT makes everything harder. Basically, there is an ADO method for inserting a record that you pass the data to it as a variant, therefore it doesn't matter how big the data is. Check this thread for a discussion of how to easily access databases - and some VIs.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(5,540 Views)