I'm very new to coding, and recently got a task to connect my SSMS/SWL Database to Visual Studio 2019.
When I press the button, the DB should connect and a message should pop up saying it's been connected.
I assume I have the incorrect login details, but I'm not sure, and even if I was sure, I wouldn't know how to find the correct login details.
So here's my current button click code:
private void button1_Click(object sender, EventArgs e)
{
string connectionString;
SqlConnection cnn;
connectionString = @"Data Source=TRISTAN\SQLEXPRESS ;Initial Catalog=TutorialDB ;User ID=TRISTAN\Tristan; Password=";
cnn = new SqlConnection(connectionString);
cnn.Open();
MessageBox.Show("Connection Open");
cnn.Close();
}
So, the login detail's I'm using are those shown when launching SSMS and the "Connect to Server" box pops up.
Am i using the login details from the correct place "Connect to server window" Or are the details I need somewhere else.
The error message I get when clicking the 'Connect' button "System.Data.SqlClient.SqlException: 'Login failed for user 'TRISTAN\Tristan'.'"
I'd appreciate any assistance, please also keep in mind I don't know much Programming language yet, so please keep it simple.