Why is my connectionString not working?
-
27. února 2012 1:33
I’m working on a project in MVC 3.
The name of my database is: SchoolIn.Models.SchoolIn.dB
Here’s my connectionString:
<connectionStrings>
<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" />
</connectionStrings>The name of my server is :MY_PC_NAME\SQLEXORESS
How can I change my configuration to make it work?
Všechny reakce
-
27. února 2012 2:12
Whenever I have connection issues I try this method
http://blogs.msdn.com/b/farukcelik/archive/2007/12/31/basics-first-udl-test.aspx
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!
- Označen jako odpověď Maggie LuoModerator 7. března 2012 8:06
-
27. února 2012 2:30Could you please post the error while connecting, also I would like you to refer this link http://connectionstrings.com/sql-server-2008
Thanks
Manish
Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful. -
1. března 2012 6:42
Hi CloudyKooper,
Try to use 'initial catalog=SchoolIn.Modles.SchoolInDB' instead of 'database=SchoolIn.Modles.SchoolInDB' since you are using 'data source=serverinstance' in connection string. If you use 'server=serverinstance' then you can use 'database=...'
Hope this help,
Agung Gugiaji
-
1. března 2012 9:16Moderátor
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.
- Označen jako odpověď Maggie LuoModerator 7. března 2012 8:06