Thursday, March 29, 2012

cant connect

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.

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.

|||

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.

|||OK, strange thing. Seems that you connected with the attachdbfile option a database, but connect with another connection to the sql server express attached database or vice versa. But you have to decide wheter you want to use the service of the direct attachdbfile way.

HTH, jens Suessmeyer.|||

Jens Suessmeyer wrote:

OK, strange thing. Seems that you connected with the attachdbfile option a database, but connect with another connection to the sql server express attached database or vice versa. But you have to decide wheter you want to use the service of the direct attachdbfile way.

HTH, jens Suessmeyer.

you are right. i attached ASPNETDB.net using attachdbfile. that is set on the web.config file.

|||

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.

|||i posted the same issue to the other page here. pls help. pls check this out > http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=68698&SiteID=1&PageID=1

No comments:

Post a Comment