YAFLogo

arifsharp
13 years ago
Hi, I am using YAF-v1.9.4 for one of our client. The application is live. Some how(I don't know) in table yaf_prov_Membership, some username end up having more than one records(and so different UserID). Because of that, when those users tries to login, they are getting following error:

Server Error in '/' Application.


Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Cannot insert the value NULL into column 'UserID', table ',myForums.dbo.yaf_prov_RoleMembership'; column does not allow nulls. INSERT fails.
The statement has been terminated.
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: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Cannot insert the value NULL into column 'UserID', table 'myForums.dbo.yaf_prov_RoleMembership'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Source Error:


Line 32: if (!RoleMembershipHelper.IsUserInRole(UserName, "Registered" ) )
Line 33: {
Line 34: RoleMembershipHelper.AddUserToRole(UserName, "Registered" );
Line 35: }
Line 36: }


What I found out is in storeprocedure yaf_prov_role_addusertorole, there is a statement SET @UserID = (SELECT UserID FROM [dbo].[yaf_prov_Membership] m WHERE m.UsernameLwd=LOWER(@Username) AND m.ApplicationID = @ApplicationID) and since those users have multiple records in yaf_prov_Membership, the application end up raising above exception.


I really need to solve this issue, I really need a quick fix for this issue, I could delete records of those users which multiple records, but it doesn't end the possibility that in future users can have multiple records and also I may loose data by doing that. Any help/suggestion would be appreciated.

Thanks.

smallfish
13 years ago
I am still getting this error for any config change (such as changing global theme, or adding a forum .
cagliostro
13 years ago
Originally Posted by: smallfish 

I am still getting this error for any config change (such as changing global theme, or adding a forum .



Can somebody cleanup this spam guy ?


Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
13 years ago
Change it to:


SET @UserID = (SELECT TOP 1 UserID FROM [dbo].[yaf_prov_Membership] m WHERE m.UsernameLwd=LOWER(@Username) AND m.ApplicationID = @ApplicationID)
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button