i am
devleoping an ASP.Net website now. i got a problem on connecting. when
i try to connect (i manually made thew connection), it wont connect.
the error is this:
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'MANEC\Batman'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
I have other other
webpage that uses sqlconenction. they connect fine but they are not
manually created. i created their connection through the sqldatasource
wizard. i am testing these pages using the built-in server of
VWD-Express but when you test it on IIS it gets an error (this is my
2nd problem). i am totally confused.
i am thinking there
is something missing in the connection that i manually created. I put
the settings in the "web.config" file but it did no good.
can you give me
instruction on how to properly connect from Web PLS i have no problem
connecting when i am creating desktop applications (using C# &
SQLExpress).
PLS HELP. pls.

cant connect
DJaus
you are right. i attached ASPNETDB.net using attachdbfile. that is set on the web.config file.
linkspeed
Anders Sneckenborg
somehow i have resolved this issue but the problem keeps on coming after another.
from the suggestion of the people from www.asp.net ( http://forums.asp.net/1/904462/ShowPost.aspx#904462 ) here is what i got now:
error after disabling "Write" capability from ACL:
System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\WWWROOT\TECHPAD\APP_DATA\ASPNETDB.MDF" because the database is read-only. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
error after ENABLING "Write" capability from ACL:
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed. Login failed for user 'MANEC\ASPNET'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
this makes me think its so hard to study VWD and SQLExpress for a newbie like me. when I run the webpages from the built-in webserver of VWD it may work fine but when on IIS it will not work (or vice-versa). so confusing. maybe bcoz im very new to this.
i find it hard to do all of these setups. i wanna learn this though. PLS HELP.
maxim4o
HTH, jens Suessmeyer.
Gabe Frost - MSFT
thanks for the reply. i have solved this issue by setting sql authentication to mixed mode and assigned a username/password on the connection string. it connects now.
i can see that the connection is ok but when i am attemting to create a new table to the ASPNETDB.mdf, i get this error message:
System.Data.SqlClient.SqlException: Unable to open the physical file "D:\myDocs\Visual Studio 2005\WebSites\techPad\App_Data\ASPNETDB.MDF". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Unable to open the physical file "D:\myDocs\Visual Studio 2005\WebSites\techPad\App_Data\ASPNETDB_log.ldf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Cannot open user default database. Login failed.
Login failed for user 'xxx'.
File activation failure. The physical file name "D:\myDocs\Visual Studio 2005\WebSites\techPad\App_Data\ASPNETDB_log.ldf" may be incorrect.at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
PLS HELP.
Martin.Cruz
Seems that the user has an orphaned database assigned to, try to set the deault database of the user to a valid one.
sp_defaultdb
Changes the default database for a Microsoft SQL Server login.
More information in the BOL.
HTH; jens Suessmeyer.