All of the connection strings you've shown are using Windows authentication, not SQL authentication.
SqlConnection.ConnectionString Property (System.Data.SqlClient) | Microsoft Docs[
^]
Integrated Security=True
and
Trusted_Connection=True
mean the same thing: use Windows authentication.
You're also missing a semicolon between the user ID and the password.
And finally, it's a really bad idea to store a connection in a class-level field. Create the connection as late as possible, and dispose of it as soon as you've finished with it. Where possible, wrap it in a
using
block to make sure it's always disposed of.
namespace ContactDirectory
{
static class connection
{
public static SqlConnection getConnect()
{
return new SqlConnection("Server=ITSTAFF\\ACOSTA,1433; Database=Contacts; User ID=ACOSTA; Password=itacosta;");
}
}
}
Microsoft SqlClient Data Provider for SQL Server Connection Strings - ConnectionStrings.com[
^]