Configuring AspNetSqlProvider to use a different database

G

Guest

I need to configure the provider to use a database in SQL Server instead of
the SQL Express database default, but the admin tool does not give any
options to change the database. Does anyone know how to change this
configuration?
 
G

gaidar

It's very easy! You should change just your connection string to point to
your SQL Server database.

Gaidar
 
G

Guest

This is a copy of what is in my web.config file.

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>

<authentication mode="Forms" />
<roleManager enabled="true" />
<compilation debug="true"/>
<customErrors mode="Off" />
</system.web>
</configuration>

As you can see there is no connection string in the config file. I am using
Visual Studio 2005 beta 2. The web site runs just fine against the SQL
Express datbase, but in the environment I am deploying it in, it will need to
go against a SQL Server.
 
B

Brock Allen

What Gaidar is saying is to alter the default connection string from the
root web.config to point to your custom database, so add something like this:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="data source=.;Integrated Security=SSPI;Initial
Catalog=aspnetdb" providerName="System.Data.SqlClient"/>
</connectionStrings>

Now every SqlServer backed provider uses the LocalSqlServer named connection,
so this, in effect, redirects all of those providers to use your custom database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,295
Latest member
EmilG1510

Latest Threads

Top