LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a UDL programmatically

Hi.
I need to create UDL to any database programmatically. I created a VI to do just this but the UDL that was generated could not be used. I am certain the content of the UDL is correct. Please help.

Find the attached VI.
0 Kudos
Message 1 of 4
(3,405 Views)
I know of two ways of creating a connection string programmatically:

1) You create it manually (via New->Microsoft Data Link from the desktop) and replace the parts you need to exchange via "format into string" in your VI. This is suitable if you e.g. need to open an Access database with no more information than the path of the database file. If you need some additional hints about connection strings, I recommend visiting this website: http://www.able-consulting.com/ADO_Conn.htm

2) You can include the WINDOWS dialog for creating a UDL in your application via ActiveX (see attached VI).
Message 2 of 4
(3,405 Views)
You might want to remove the first two lines from the constant in your VI. It might also make sense to wrap the path into "".
0 Kudos
Message 3 of 4
(3,405 Views)
Not sure if this will help, but here is a file for creating the ODBC DSN names progammatically. I got this off of the NI website.
0 Kudos
Message 4 of 4
(3,405 Views)