locked
Cannot open user default database. RRS feed

  • Question

  • User1859594047 posted

    Good morning guys,

    recently with no reason this error came up, my database worked fine until a few days, this error start when i used a gridview, and after delete it, is it related?

    It may be a problem in  "web.config"?

    Error: 

    Cannot open user default database. Login failed.

    Login failed for user 'LAPTOP-HKQ9V89M\Perusso'.

    Monday, May 23, 2016 9:01 AM

Answers

  • User-166373564 posted

    HI perusso,

    perusso

    Cannot open user default database. Login failed.

    Could you try modify the connection string from LocalDB to (localdb)\MSSQLLocalDB? and check whether it is this issue.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 24, 2016 6:22 AM

All replies

  • User-166373564 posted

    HI perusso,

    perusso

    Cannot open user default database. Login failed.

    Could you try modify the connection string from LocalDB to (localdb)\MSSQLLocalDB? and check whether it is this issue.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 24, 2016 6:22 AM
  • User1859594047 posted

    HI perusso,

    perusso

    Cannot open user default database. Login failed.

    Could you try modify the connection string from LocalDB to (localdb)\MSSQLLocalDB? and check whether it is this issue.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />

    Regards,

    Angie

    I have done it, it did work, thank you angie, you were a great help

    Tuesday, May 24, 2016 10:11 AM
  • User-166373564 posted

    Hi perusso,

    Glad that it can fix this issue, and thanks for kind feedback. : )

    Best regards,

    Angie

    Wednesday, May 25, 2016 1:27 AM