Aspnetdb.mdf failed a Database with the Same Name Exists

by top54u.com 19 May, 2008
Spotlight.....

While hosting the ASP.Net web site having Aspnetdb.mdf database, number of people face the problem of "failed to create database with the same name exits" when they try to create aspnetdb for their sites. Sometimes this problem also occur offline when developers try to create the aspnetdb during web site development phase. This is very common issue for beginners when they are in learning phase.

ASP.Net automatically creates the default database file with name aspnetdb, but it’s not good to use the same name of default database for connecting it the web application coz it will definitely cause the problem of name conflicts while hosting the web site online. SQL Server 2005 doesn’t allow multiple database instances with same name whether they are associated with different users or websites.

But how to resolve this problem of Aspnetdb.mdf failed a Database with the Same Name Exists?
You can solve this problem by changing the name of aspnetdb.mdf file before connecting it to the asp.net web application. To do so just right click on aspnetdb.mdf file and select rename from the menu. Change the name of file associated with web application without changing the .mdf extension.

Other way to bypass the problem is create the default database using aspnet_regsql command and set the appropriate database name while following the wizard to create and configure the aspnetdb.mdf database with new name.
See the steps to create aspnetdb database here …
Note: Enter the different name for database instead of default while creating the database.

You can use the default database with different name just by using the connection string normally. Remember that connectionstring name should be LocalSqlServer. This will solve all your problems.

Spotlight.....

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

7/24/2008 5:25:33 PM

OUR SPONSORS[+ advertise here]
top54u ezines.....
related videos.....
recent posts.....