Why is my connectionString not working?


  • I’m working on a project in MVC 3.

    The name of my database is:  SchoolIn.Models.SchoolIn.dB

    Here’s my connectionString:

          <add name="ApplicationServices"
           connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
           providerName="System.Data.SqlClient" />

          <add name="SchoolInDB"
            connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI; Database=SchoolIn.Modles.SchoolInDB; Trusted_Connection=True;User Instance=true; MultipleActiveResultSets=true"
            providerName="System.Data.SqlClient" />

    The name of my server is :MY_PC_NAME\SQLEXORESS

    How can I change my configuration to make it work?

    27 февраля 2012 г. 1:33


  • Whenever I have connection issues I try this method

    Give it a go and confirm your settings are correct and not a string syntax error in the UI

    Best Wishes, The Redman; If something helps, please help show it by voting, if it solves, bonus!

    • Помечено в качестве ответа Maggie LuoModerator 7 марта 2012 г. 8:06
    27 февраля 2012 г. 2:12
  • Hello,

    Please, could you explain "The name of my server is :MY_PC_NAME\SQLEXORESS"  ?

    I suppose that the name of your computer is MY_PC_Name and the name given during the install of SQL Server Express is SQLEXORESS ( or SQLEXPRESS default value proposed at the install ). If the name of your SQL Server Express is SQLEXORESS, you have to replace .\SQLEXPRESS by .\SQLEXORESS for the value of datasource in your connection string.

    Have a nice day

    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    • Помечено в качестве ответа Maggie LuoModerator 7 марта 2012 г. 8:06
    1 марта 2012 г. 9:16

Все ответы