Invalid value for key 'integrated security'

10,753

Clearly, you are missing a semi-colon after SSPI, so the argument is being read as SSPIAttachDbFilename=E:\\user\\program\\Database1.mdf which is not a valid value for Integrated Security.

This should work.

var sc = new SqlConnection("Data Source=(LocalDB)\\v11.0; Integrated Security=SSPI;" 
                               + "AttachDbFilename=E:\\user\\program\\Database1.mdf")
Share:
10,753
Szejp
Author by

Szejp

Updated on July 10, 2022

Comments

  • Szejp
    Szejp almost 2 years

    I need a help. I got this:

    SqlConnection sc = new SqlConnection("Data Source=(LocalDB)\\v11.0; Integrated Security=SSPI" + "AttachDbFilename=E:\\user\\program\\Database1.mdf");    
    

    I tried to set Integrated Security to True or even False. None of them works. Help!