I\'m getting the following error:
Login failed for user \'sa\'
When I try to connect server by setting value through a string v
Maybe the server name and the database name (in the dbname and catname variables) are just wrong?
BTW, i would recommend using the SqlConnectionStringBuilder class.
var sb = new SqlConnectionStringBuilder() { InitialCatalog = catname,
DataSource = dbname,
UserID = "sa",
Password = "sa" };
var dbConnection = new SqlConnection(sb.ConnectionString);