LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass a database connection reference (Conn ObjectReference.ctl) to a Subvi

Hi All,

 

The attached code works to call a stored procedure in SQL 2008 Express.

I wanted to create a Subvi of everything except the Database Open, because I only want to have it open once.

I placed a Conn ObjectReference.ctl on the front panel of the subvi and connected the connection reference from the DB Open to the subvi. It seems to like that well enough,

but I get a runtime error:

ADO Error 0x00000001

The file provided is not a datalink (UDL) or a file DSN.

 

Does anyone have any pointers?

 

Thanks,

Paul

0 Kudos
Message 1 of 5
(4,260 Views)

Hi Paul,

 

try creating the subVI from the Edit->Create SubVI Menu (select the block diagram objects to be put into the SubVI first!)

If that fails too, please post a real source VI rather than a screenshot (you can also post snippets Smiley Happy )

 

Regards

 

(btw.: some pointers for you ...  http://xkcd.com/138/ (hope you can laugh about it too) )

_________________________
CLA
0 Kudos
Message 2 of 5
(4,246 Views)

Yes, I can laugh about it Smiley Happy

 

I did create the subvi as you suggested.

Here is a vi with the code that works and the call to the subvi which does not work, but of course it won't work at all unless you have a database named EDS_Test with a stored procedure called uspSensor_Log_Ins

As you can see, it looks like it is connected correctly, but the subvi stops with the error.

 

Regards,

Paul

Download All
0 Kudos
Message 3 of 5
(4,240 Views)

I still cannot run the VIs since the owning library is missing (as reported by LV).

 

However, you also need to wire the reference control that you have inserted to the execute query VI - then the reference gets propagated.

If you have troubles to find the corresponding terminal (because it's far down the block diagram), double-click the control on the front panel window.

 

snip.png

 

Regards

_________________________
CLA
0 Kudos
Message 4 of 5
(4,233 Views)

I got enough clues from your diagram to figure it out.

I didn't get the reference in the subvi put in correctly, It was like a new one and not a reference.

It works now.

Thanks a lot,

Paul

0 Kudos
Message 5 of 5
(4,228 Views)