private SQLDMO.SQLServer srv = new SQLDMO.SQLServerClass();
srv.Connect(ServerName,Login,Password);
This is all good and well, but I want to also allow the user to log in using Windows Authentication. The problem here being that I the srv.Connect method Must have a login and password, but I do not know how to pass these parameters. How can I do this?

Jan MontanoRank #1,295 · 1.3K reputationPosted Jun 27, 2007, 2:59 AM EDT
sqlConnection = SqlConnection("data source=bondugula; initial catalog=Northwind; integrated security=SSPI; persist security info=False; Trusted_Connection=Yes");
sqlConnection.Open();
But for SQLDMO, you could try this:
sqlServer.LoginSecure = true;
sqlServer.Connect(ServerName, "", "");
Ryan7 reputationPosted Jun 27, 2007, 6:14 AM EDT
To answer some questions regarding why I wanted this: The reason I am doing it this way is that I am building the connection string based on user input. Once the user selects their logon type (sql server logon or windows authentication), a catalog combobox gets populated. The user then selects which database to connect to, the connection string is made, and voila.