In stock:

string serverName = "ServerName"; string databaseName = "DatabaseName"; string login = "UserName"; SecureString password; 

I use the designer

ServerConnection serverConnection = new ServerConnection(connectionString, login, pass);

Tried to combine options for connectionString - and did not understand how to properly. In the example on MSDN, they are simply connected to the server, and I need to write to a specific database. Before that, I simply used

  connectionString = "Data Source=" + serverName + ";Initial Catalog=" + databaseName + ";Login=" + login + ";Pass=" + password + ";"; 

And everything worked. There is a requirement to use SecureString - stupor.

  • Again, I do not have enough reputation to issue a cue, which does not pull on the answer, as a comment. As far as I understand, you cannot extract content from SecureString. If so, then look here cyberforum.ru/csharp-beginners/thread1728117.html - Alexander Muksimov
  • I solved the problem differently. I simply connected to the server through a constructor with three arguments: (string server, string login SecureString pass), then I initialized a variable of type Database -> (string server, string db). - Bloodskys

0