Compartilhar via


How to use SQL Server in ASP.NET 2.0, if you don't have SQL Express for VS 2005

I don't have the SQL Express on my box and I still want to use database for my ASP.NET 2.0 application. Here is what I do to configure each of my application to use the MS SQL 2000.

1) Go to the the Visual Studio 2005 command prompt OR a regular command prompt and navigate to C:\<WINDOWS>\Microsoft.NET\Framework\v2.0.50727.
2) Type aspnet_regsql and hit Enter.
3) You will see a Wizard. Click Next.
4) Select "Configure SQL Server for application services". Click Next.
5) Provide your "ServerName" and let "Windows Authentication" be checked.
6) Provide a Database Name (eg. aspnetdb). Click Next. In the next screen Click Finish.
7) Now, open your ASP.NET website in VS 2005.
8) Open your Web.config.
9) Just after your <appSettings/> line type the following...

 <connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial
          Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

10) Now, if you run your ASP.NET 2.0 application's ASP.NET Configuration tool, you should be able to use that without your SQL Express. :o)

Hope that helps.
Rahul Soni

Comments