LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert cluster into database

Solved!
Go to solution
Highlighted

I am trying to insert a cluster into a SQL database using the database connectivity tools. I get an error (attached). See attached the code I am using

----------------------------------------------------------------------------------
I have not lost my mind, it's backed up on a disk somewhere
Download All
0 Kudos
Message 1 of 15
(1,362 Views)
Highlighted

Looks to me like the string is too long for the string field in the DB.

(You should wire the cluster directly instead of going via ref->property)

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 15
(1,345 Views)
Highlighted

Hi Yamaeda

 

The cluster is being wired directly using a local variable it's just the way the code snippet saved it for uploading

----------------------------------------------------------------------------------
I have not lost my mind, it's backed up on a disk somewhere
0 Kudos
Message 3 of 15
(1,342 Views)
Highlighted

Then you have a race condition. You cant guarantee the local variable is using the newest or previous value, it's depending on when it updates ... wire directly to make sure.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 15
(1,340 Views)
Highlighted

I wired directly still resulting in the same error

----------------------------------------------------------------------------------
I have not lost my mind, it's backed up on a disk somewhere
0 Kudos
Message 5 of 15
(1,336 Views)
Highlighted

Hi,

I could not see your code because I dont have 2013 with me. please check following points

 

1. Please connect column name input

2. Make sure number of elements in cluster equals number of column.

3. make sure data type for each element is properly defined in SQL table, generally assigning text does not cause problems.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 6 of 15
(1,325 Views)
Highlighted

So, how long text are you sending to the database, and how long it the text field configured?

Can you "make current values default" after a unsuccesful run and post the vi so we can see what you're sending?

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 15
(1,324 Views)
Highlighted

I'm using labview to create the table using the insert vi by setting create table to true. If I connect the columns I get error 1 saying the number of columns does not match the the number of parameters

----------------------------------------------------------------------------------
I have not lost my mind, it's backed up on a disk somewhere
0 Kudos
Message 8 of 15
(1,318 Views)
Highlighted

I will still suggest to connect column names, and make sure you have equal number of column and elements to be inserted.

 

As error it self is suggesting that number of elements and number of column are not matching, please check that part.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 9 of 15
(1,311 Views)
Highlighted

If possible share code in LabVIEW 2010 version so that I can take a look.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 10 of 15
(1,308 Views)