LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Connection Reference in While Loop

Solved!
Go to solution

Hi,

 

As shown in picture below, i have DB connection reference. "Connection properties 2" indicator shows proper values, but the same "Connection properties" indicator in while loop shows nothing, but connection numbers are the same (in probe). There is event structure in this while loop also if it matters. Why i can't get proper connection reference from while loop?

 

I'm using LV2011.

 

Regards,

Kacper

labview event case reference.png

 

0 Kudos
Message 1 of 19
(4,848 Views)

Try putting a timeout, such as 100 ms, on the event structure (upper left corner icon). By default it is -1 (wait forever until event).

0 Kudos
Message 2 of 19
(4,843 Views)

That's no problem. I fired this event (Results Button - Value Changed). This is strange problem - i attached next image.

labview while  db ref.png

When i run this VI, "connection properties 2" indicator shows proper values only in first loop iteration. After next iterations values are null. Maybe there is problem with ActiveX (ADO)? I'm using MySQL ODBC Unicode Driver.

0 Kudos
Message 3 of 19
(4,833 Views)

You create a branch of the connection before the while loop and it disappears off screen.  I assume you take that over to a close connection where it gets closed.

aputman
0 Kudos
Message 4 of 19
(4,823 Views)

I close connection at the end of application. There is only small part on images.

 

In addition - i have following error from 'DB Tools Get Properties' after first iteration.

 

NI_Database_API.lvlib:Conn Get Properties.vi->Controller.lvlib:Controller.lvclass:Actor Core.vi:1->Actor Framework.lvlib:Actor.lvclass:Actor.vi:7->Actor Framework.lvlib:Actor.lvclass:Actor.vi.ACBRProxyCaller.FC600014<ERR>ADO Error: 0x00000001
Property Node (arg 1) in NI_Database_API.lvlib:Conn Get Properties.vi->Controller.lvlib:Controller.lvclass:Actor Core.vi:1->Actor Framework.lvlib:Actor.lvclass:Actor.vi:3->Actor Framework.lvlib:Actor.lvclass:Actor.vi.ACBRProxyCaller.FC10001A

0 Kudos
Message 5 of 19
(4,817 Views)

What you are calling "the end of the application" is not actually that.  You must understand dataflow.  Find some tutorials on this and you'll soon understand the problem.

 

aputman
0 Kudos
Message 6 of 19
(4,812 Views)

@kacperek wrote:

I close connection at the end of application. There is only small part on images.

 

In addition - i have following error from 'DB Tools Get Properties' after first iteration.

 

NI_Database_API.lvlib:Conn Get Properties.vi->Controller.lvlib:Controller.lvclass:Actor Core.vi:1->Actor Framework.lvlib:Actor.lvclass:Actor.vi:7->Actor Framework.lvlib:Actor.lvclass:Actor.vi.ACBRProxyCaller.FC600014<ERR>ADO Error: 0x00000001
Property Node (arg 1) in NI_Database_API.lvlib:Conn Get Properties.vi->Controller.lvlib:Controller.lvclass:Actor Core.vi:1->Actor Framework.lvlib:Actor.lvclass:Actor.vi:3->Actor Framework.lvlib:Actor.lvclass:Actor.vi.ACBRProxyCaller.FC10001A


You are getting this error because you are closing the connection before you realize.  These two sections of code are not the same.  The bottom one will give the error that you are getting.

Capture.JPG

aputman
0 Kudos
Message 7 of 19
(4,805 Views)

@aputman It does not matter. It's reference to some point in memory. It should work this way until i close connection (by reference). Now i have error after first use of this reference and i think it's strange bahaviour.

0 Kudos
Message 8 of 19
(4,801 Views)

What doesn't matter?  If i am misunderstanding something, you'll have to post some code because that is the obvious answer with what you have given us to work with.

aputman
0 Kudos
Message 9 of 19
(4,797 Views)

It's not the dataflow.

 

This doesn't work too.

 

It's strange, because i can use this connection reference before the while loop. i'm getting records from DB before loop (not on this screenshot). Problem appears in while loop after first iteration.

1.png

0 Kudos
Message 10 of 19
(4,795 Views)