Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid value for key 'integrated security' [closed]

Tags:

c#

sql-server

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!

like image 532
Szejp Avatar asked Oct 24 '14 10:10

Szejp


1 Answers

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")
like image 147
Ondrej Janacek Avatar answered Sep 21 '22 09:09

Ondrej Janacek