locked
Error accessing new SQL database by Vidual Studio website RRS feed

  • Question

  • I am getting a Server Error when I run a website locally in Visual Studio which says, ‘Cannot open database "EFMDB" requested by the login.’  It seems to be able to recognize my SQL user identity of: MO0621121334\Maurice, but not my database.  In SQL Server Management Studio, it connects to: MO0621121334\SQLEXPRESS (SQL Server 9.0.3052 - MO0621121334\Maurice) where EFMDB is created under Databases with many tables that are also defined.  The connection string used in my “web.config” file for my website states: connectionString="Data Source=MO0621121334\Maurice; Initial Catalog=EFMDB;Integrated Security=True".  The error message received is included below.  I do not know what else to do.  Please help. 

    Maurice

    Server Error in '/EFM' Application.

    Cannot open database "EFMDB" requested by the login. The login failed.
    Login failed for user 'MO0621121334\Maurice'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Data.SqlClient.SqlException: Cannot open database "EFMDB" requested by the login. The login failed.
    Login failed for user 'MO0621121334\Maurice'.
    Source Error:

    
    
    Line 63:         
    Line 64:         DataClassesDataContext db = new DataClassesDataContext();
    Line 65:         Profile profile = db.Profiles.SingleOrDefault(p => p.Callsign == TextBox1.Text.Trim());
    Friday, June 29, 2012 12:04 AM

Answers

  • it connects to: MO0621121334\SQLEXPRESS (SQL Server 9.0.3052 - MO0621121334\Maurice) where EFMDB is created under Databases with many tables that are also defined.  The connection string used in my “web.config” file for my website states: connectionString="Data Source=MO0621121334\Maurice; Initial Catalog=EFMDB;Integrated Security=True". 

    
    

    Hello Maurice,

    What is now the real instance name of your SQL Server: SQLEXPRESS, as you wrote in your description or MAURICE, as you used in the connection string?

    Can you connect with SSMS to the instance and which instance you are using there; this one you should use in the connection string as well (I am sure it is SQLEXPRESS ...)


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing


    Friday, June 29, 2012 4:25 AM

All replies

  • it connects to: MO0621121334\SQLEXPRESS (SQL Server 9.0.3052 - MO0621121334\Maurice) where EFMDB is created under Databases with many tables that are also defined.  The connection string used in my “web.config” file for my website states: connectionString="Data Source=MO0621121334\Maurice; Initial Catalog=EFMDB;Integrated Security=True". 

    
    

    Hello Maurice,

    What is now the real instance name of your SQL Server: SQLEXPRESS, as you wrote in your description or MAURICE, as you used in the connection string?

    Can you connect with SSMS to the instance and which instance you are using there; this one you should use in the connection string as well (I am sure it is SQLEXPRESS ...)


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing


    Friday, June 29, 2012 4:25 AM
  • Thank you VERY much!  You are absolutely correct.  The real instance name of my SQL Server is SQLEXPRESS and not MAURICE, as I have in my connection string.  I changed the connection string and everything works fine now.  Thanks again.

    Maurice

    Friday, June 29, 2012 3:27 PM