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).