I have a connection string like the following:
"Data Source=db; Initial Catalog=t; Integrated Security=SSPI; User id=u; Password=p"
I'm specifying a specific user i want people to be using to access the database. However, when they run the function that calls this, users are reporting an error that their user doesn't have permission to connect to that database.
I've stepped through i'm able to log in, so for some reason either a) i'm using the credentials and other users are not, or more likely b) i have access to the database and other users are not.
I'm not sure why it's not picking up this connection string and using it.
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
cmd.CommandText = searchString();
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
reader = cmd.ExecuteReader();
sqlConnection1 is the above string with proper values inplace of placeholders. I'm specifically not doing anything fancy here to just debug this. Can provide more info if not enough/needed. But that's the majority of the issue.