Friday, February 24, 2012

ASPNETDB.MDF I need to rename this file

I need to rename this db and be able to set a path to it. This is because my webhost places all SQL databases on a seperate drive. This is a shared drive with alot of other databases. There fore my ASPNETDB.MDF needs to be renamed and have a path assigned. This doesnt seem tro be taken care of in my web.config file? Can some one help in reasigning the default database name and pathway. my other databases were pretty straight forward.

Thanks

Use this setting in web.config:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.mdf;Database=ms;Trusted_Connection=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings
Replace the AttachDbFilename setting with your own.

Jos

|||

I don't believe the autoattach feature with the User Instance attribute is going to work in a hosted web site, as this only works with SQLEXPRESS and only for the local machine. Most likely your hoster is NOT running SQL Express. You can use the Database Publishing Wizard to script the entire database, connect to the one for your account at the hoster, and run your script to recreate your "stuff".

|||

Both these answers are good. I dont seem to have a database publishing wizard in my express editions. I do need to get access to this though as am using scripts atm.

I have created a passwords login page and roles. when i set these in the web administration tool it created a db called ASPNETDB.MDF.

in the public database drive at my webhost there are lots of db's and I have to give my db a unique name. When I try and change the name of this db on my development system express creates a new db with the name ASPNETDB.mdf.

(due to a video i just saw) I think I can solve this issue by running aspnet_regsql but i cant get this program to access ssmse as my development copy of ssmse does not allow remote access.

|||

There are System.Web.Management (I believe that's the namespace) classes that allow you to create code (or a page) that does everything that ASPNET_REGSQL.EXE does.

The Database Publishing Wizard is a free download. Look it up on the web. Cheers.

|||

Thanks to you both you have been a great help.

No comments:

Post a Comment