Showing posts with label fix. Show all posts
Showing posts with label fix. Show all posts

Monday, March 19, 2012

Help needed with an error message

I have been putzing with this error message for a couple of hours now, and I cannot seem to get it to go away. Any ideas on how to fix it? I have verified that the user name, password, and server location is all correct.

System.Data.SqlClient.SqlException: Login failed for user 'xxxxxx'. Reason: Not associated with a trusted SQL Server connection. at System.Data.ProviderBase.DbConnectionPool.GetConnection(Object owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnectionBase owningConnection) at System.Data.ProviderBase.DbConnectionClosed.Open(DbConnectionBase outerConnection) at System.Data.ProviderBase.DbConnectionBase.Open() at System.Data.SqlClient.SqlConnection.Open() at xxxxx.selection.FillDGResults() in c:\inetpub\wwwroot\xxxxx\xxxxx.aspx.vb:line 74

Thanks!

Dancan you post your connection string ? check if the user name exists in the users tab of the database.

hth|||Here is my connection string. Naturally, the ID, Password, and location have all been altered for security reasons.

<code.<appSettings>
<add key="cnSystem" value="packet size=4096;user id=userID; data source=SQLSERV;="None";persist security info=True;initial catalog=System;password=hellothere" />
</appSettings> </code>|||Scratch that last post... I posted a messed up version. It should read

<code. <appSettings>
<add key="cnSystem" value="packet size=4096;user id=userID; data source=SQLSERV;persist security info=True;initial catalog=System;password=hellothere" />
</appSettings> </code>|||Is the SQL Server set to allow both trusted logins and sql server logins? The error message suggests that it is expecting a trusted connection (trusting the domain authentication) yet your connection string contains a user name and password.

Friday, February 24, 2012

Help me to fix this error

hi all

Server Error in '/test' Application.

Cannot open database requested in login 'mehr'. Login fails. Login failed for user 'COMPUTER2\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Cannot open database requested in login 'mehr'. Login fails. Login failed for user 'COMPUTER2\ASPNET'.
Source Error:
Line 67: Line 68: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickLine 69: cmd.Connection.Open()Line 70: cmd.ExecuteNonQuery()Line 71: cmd.Connection.Close()

Source File:c:\inetpub\wwwroot\test\WebForm1.aspx.vb Line:69
Stack Trace:
[SqlException: Cannot open database requested in login 'mehr'. Login fails.Login failed for user 'COMPUTER2\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 test.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\test\WebForm1.aspx.vb:69 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1277


Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


thanks for your replyMeans user computer2/aspnet isnt a valid user in your database mehr. You either need to add the user, or add a different user to your connection string.

Nick