1

I've a local html page that I'm working on. It's mostly HTML and Javascript and some aspx c#. Whenever I am trying open the database, I get error: System.Data.SqlClient.SqlException: Cannot open database "Database.mdf" requested by the login. The login failed. Login failed for user 'ROYI\user'. I searched a bit on the internet, and I've learned that this uses the windows authentication but it doesn't seem to work. I don't have a password for this db, so why can't it connect?

My connection string is:

"Server= localhost; Database=Database.mdf; Integrated Security = SSPI; ";

When I do:

SqlConnection conn = new SqlConnection(connString);
conn.Open();

I get the error on conn.open();.

Where is the problem with my connection string?

jarlh
  • 42,561
  • 8
  • 45
  • 63
Royi Levy
  • 513
  • 1
  • 3
  • 14

0 Answers0