I encountered this problem while trying to develop webparts on a my development machine with Sharepoint 2007 (a win2k installation), and found a solution on this page.
Initially the problem occurred because I hadn’t rerun the aspnet_regsql.exe utility. So I did, but I already had SQL Server installed when I setup Visual Studio. As a consequence, SqlExpress wasn’t installed and I used the full-blown SQL install setup with Sharepoint. If you don’t have Sharepoint on your machine, adding the following to your application’s web.config should work just fine:
<connectionStrings>
<clear/>
<add name=”LocalSQLServer” connectionString=”Server=.;Database=aspnetdb;trusted_connection=yes”/>
</connectionStrings>
That got me most of the way, but because I used my SharePoint install, the ASP.NET databse went onto #YourServername#\OFFICESERVERS.
To resolve this you need to change the string to.
<add name=”LocalSQLServer” connectionString=”Server=#YourServerName#\OFFICESERVERS;Database=aspnetdb;trusted_connection=yes”/>
Sorted.