Here is a snip of code from my Login screen. It has the usual Server Name, User name and Password texboxes, and a Login and Cancel button. Mine is hardcoded for a database named SAFEnet. This is using the SQLclient (SQL2005). If you are using another type DBMS, let me know, and I will show you that code.
I use a string to contain the ConnectionString value, then use the replace method to build in the parameters. The Login button calls this code:
There are other ways of handling the string, this just makes it more readable. The bottom line is that you contruct the connection string and pass it to the open procedure of the Connection object.
Note: you will want to wrap the connection in a try..catch