Hi. I've imported an mvc project that I did not build myself, and I'm trying to open it in Visual Web Developer 2010 Express. I keep getting this error when I run Debug:
Cannot open database "DatabaseName" requested by the login. The login failed.
Login failed for user UserName
Now, I'm very new to asp.net, so I don't really know where to begin. I do notice that databases I've created in my own projects have had the .sdf file extension, whereas the database I'm failing to connect to is .mdf. Also, I don't see the .mdf in the App_Data folder in the Solution panel (I'm guessing this could very well be the problem).
Another possibility is that the problem is with the connectionString in Web.config. This is the default connectionString that Visual Web Developer gives me when I create a project, but it don't work
Error say that you either do not have database with which you attempt to connect or your user does not have authorization to connect to that database.
First of all do you even have this "default" database aspnetdb.mdf?
Installing Visual Web Developer 2010 Express does not exactly means that you installed SQL Express as well.
Check if you have services for SQL running in task manager and if you do - download SQL management studio and see what you really have there and what users can work with your database.
Apply your discoveries to connection string, first start with creating ODBC (administrative tools) with credentials you find to connect to your database. This way you can be sure that connection string will have proper values.
ps. Do you know that you can download fully functional SQL server and run it for about 120 days on your local system for testing/learning purposes.
That would solve many problems for you and let you really learn NET full potential. SQL express is kind of dummy version and not really good especially for beginer.
Hi. Thanks for your reply. I have "SQL Server 2008 R2" and "SQL Server 2008" listed in my Programs menu (will these stop working after 120 days? I didn't pay for them, they installed themselves when I installed VS Express).
I tried SQL management studio, but couldn't get it to work. In the end, I just used a connection string that connects to the live database. That should suffice for now.
if you have evaluation version than yes; but if you have fully functional version then you should have this in your start menu: SQL Server Management Studio and it should work.
And what exactly you could not make work in management studio?
Unfortunately for MySQL functionality available there is way down when compare to MS SQL. Back to the topic.
So do you have Management studio up and running?
I was surprised to see after I installed WD Express that it did install instance SQL server Express but does not have any useful databases in it. That is probably your case as well.