From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

INSERT, UPDATE and SELECT data of cluster to/from DB

Hellow,

I have cluster of same data. This cluster/data I want save to Database. For this I use INSERT or UPDATE. Table column for this cluster is Binary type.


Problem:
I SELECT this cluster/data from DB, but is it OLE Variant type. In Variant Indicator I can see:
   OLE Variant

   Variant Type -> VT_ARRAY|VT_UI1
   Value -> Array(Non Displayable)

How can I convert OLE Variant data (array of U8) back to cluster of my type? When I use 'Variant to Data' with my original cluster LabVIEW return Error -2147352571 ;-(

THX
 JCC

P.S.: I can not use cluster -> XML because in this cluster will be LabVIEW types and binary data [Images, etc.]
0 Kudos
Message 1 of 2
(2,789 Views)
OK, thank you Vlado

We found solution:

I can convert may cluster/variant with 'Flatten To String.vi' to string. This string I save to DB.

After this string I can convert from DB Variant to string and after from string to original cluster/variant by 'Unflatten From String.vi'

It is working well. You can save to DB cluster with IMAQ Images.

I recommend use small table with 'cluster_ID'[int] and 'string_data'[text] ::: "Because SQL Server stores text/ntext columns on the Text/Image pages separately from the other data, stored on the Data pages, it can take more time to get the text/ntext values."

More details:
http://www.databasejournal.com/features/mssql/article.phpr/2212141
0 Kudos
Message 2 of 2
(2,763 Views)