1

I'm having problems whenever I run my application, it says that the connection is wrong. The error is User '' has failed.

I think I didn't specify the user id and password but I don't know what is the user id and my password.

Here's my connection string

public SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=PayrollDB;Persist Security Info=True;");

Thanks in advance!

3 Answers 3

6
public SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=PayrollDB;Persist Security Info=True;Integrated Security=true;");

add Intergrated Security=true to connection string.

Sign up to request clarification or add additional context in comments.

6 Comments

error says " Additional information: Keyword not supported: 'intergrated security'."
Change it to Integrated Security. I spelled it incorrectly
I already tried, no error has found but while running, it instantly stopped and I don't know why :(
Debug and check for any errors. Are you able to open connection using con.Open()
Thank you so much :D It is really crucial when you missed the name of the database. VS doesn't even recognize the error and I really need to check each lines of my connection to find the persisting bug. Thank you @Akshey. God bless! + :)
|
2

You need to add the connection string attribute: Integrated Security = true. And this will work correctly.

1 Comment

Error says " Additional information: Keyword not supported: 'intergrated security'."
1

To allow windows authentication, you need to add integrated security set as tru in your connection string like this:

public SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=PayrollDB;Persist Security Info=True;Integrated Security=true;");

2 Comments

Error says " Additional information: Keyword not supported: 'intergrated security'."
I've fixed the typo. It's Integrated Security=true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.