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?
RyanPosted Jun 27, 2007, 10:14 AM
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.
Jan MontanoPosted Jun 27, 2007, 6:59 AM
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, "", "");