Welcome Guest Search | Active Topics | Log In | Register

Cannot insert the value NULL into column 'UserID' - yaf 193 Options · View
bigdog
#1 Posted : Wednesday, September 17, 2008 7:06:08 PM

Rank: YAF Forumling


Joined: 9/17/2008
Posts: 7
Location: NY
Hello everybody,

I'm trying to run a fresh install of 193 i got from

https://yafdotnet.svn.so.../yafdotnet/trunk/yafsrc

I searched the forum and found people who have had the same problem but nobody mentioned a solution. It seems like i'm missing something simple.

Thanks

This is the error

Cannot insert the value NULL into column 'UserID', table 'yafnet193.dbo.yaf_UserGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Source Error:


Line 387: {
Line 388: cmd.Transaction = trans;
Line 389: cmd.ExecuteNonQuery();
Line 390: trans.Commit();
Line 391: }


Source File: D:\SITES\yaf1933_beta\YAF.Classes\YAF.Classes.Data\DBAccess.cs Line: 389
bigdog
#2 Posted : Saturday, September 20, 2008 4:16:45 PM

Rank: YAF Forumling


Joined: 9/17/2008
Posts: 7
Location: NY
Anybody?
test2005
#3 Posted : Saturday, September 20, 2008 8:58:59 PM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 927
Location: Italy
what are you tryingto do when you get this error?
.....the man in black fled across the desert..........and the gunslinger followed.....

bigdog
#4 Posted : Sunday, September 21, 2008 4:03:43 AM

Rank: YAF Forumling


Joined: 9/17/2008
Posts: 7
Location: NY
sorry.

i'm trying to create a new user.
test2005
#5 Posted : Sunday, September 21, 2008 7:06:06 AM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 927
Location: Italy
If your doing a site integration, make sure all of your old groups got imported into YAF. If your doing a fresh install, try re-creating the DB again.
.....the man in black fled across the desert..........and the gunslinger followed.....

bigdog
#6 Posted : Monday, September 22, 2008 4:18:55 AM

Rank: YAF Forumling


Joined: 9/17/2008
Posts: 7
Location: NY
OK after re-installing a new db i still get the same problem

Cannot insert the value NULL into column 'UserID', table 'yaf193b.dbo.yaf_UserGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.

I get this error whenever I click on any link - search, active topics, log in, register, forum link, rss feed, anything.
Jaben
#7 Posted : Monday, September 22, 2008 10:18:12 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
Known issue. Fix is in RC1 which is not released yet. Changes are to one of the stored procedures. Run this SQL to fix:

Code:

ALTER PROCEDURE [dbo].[yaf_user_aspnet](@BoardID int,@UserName nvarchar(50),@Email nvarchar(50),@ProviderUserKey nvarchar(64),@IsApproved bit) as
BEGIN
      SET NOCOUNT ON

      DECLARE @UserID int, @RankID int, @approvedFlag int

      SET @approvedFlag = 0;
      IF (@IsApproved = 1) SET @approvedFlag = 2;      
      
      IF EXISTS(SELECT 1 FROM [dbo].[yaf_User] where BoardID=@BoardID and ([ProviderUserKey]=@ProviderUserKey OR [Name] = @UserName))
      BEGIN
            SELECT TOP 1 @UserID = UserID FROM [dbo].[yaf_User] WHERE [BoardID]=@BoardID and ([ProviderUserKey]=@ProviderUserKey OR [Name] = @UserName)

            UPDATE [dbo].[yaf_User] SET
                  [Name] = @UserName,
                  Email = @Email,
                  [ProviderUserKey] = @ProviderUserKey,
                  Flags = Flags | @approvedFlag
            WHERE
                  UserID = @UserID
      END ELSE
      BEGIN
            SELECT @RankID = RankID from [dbo].[dbo].[yaf_Rank] where (Flags & 1)<>0 and BoardID=@BoardID

            INSERT INTO [dbo].[yaf_User](BoardID,RankID,[Name],Password,Email,Joined,LastVisit,NumPosts,TimeZone,Flags,ProviderUserKey)
            VALUES(@BoardID,@RankID,@UserName,'-',@Email,getdate(),getdate(),0,0,@approvedFlag,@ProviderUserKey)
      
            set @UserID = SCOPE_IDENTITY()
      
      END
      
      SELECT UserID=@UserID
END
GO
"When you are grateful, fear disappears and abundance appears”."

jafin
#8 Posted : Monday, September 29, 2008 8:13:01 AM

Rank: YAF Forumling


Joined: 12/13/2005
Posts: 1
Location: Australia
Just check, there are 2 [dbo].[dbo] on one line.

Quote:
SELECT @RankID = RankID from [dbo].[dbo].[yaf_Rank] where (Flags & 1)<>0 and BoardID=@BoardID


If you are using the svn code try this patch:

Quote:
Index: procedures.sql
===================================================================
--- procedures.sql (revision 2167)
+++ procedures.sql (working copy)
@@ -4309,7 +4309,7 @@
UserID = @UserID
END ELSE
BEGIN
- SELECT @RankID = RankID from [dbo].[{databaseOwner}].[{objectQualifier}Rank] where (Flags & 1)<>0 and BoardID=@BoardID
+ SELECT @RankID = RankID from [{databaseOwner}].[{objectQualifier}Rank] where (Flags & 1)<>0 and BoardID=@BoardID

INSERT INTO [{databaseOwner}].[{objectQualifier}User](BoardID,RankID,[Name],Password,Email,Joined,LastVisit,NumPosts,TimeZone,Flags,ProviderUserKey)
VALUES(@BoardID,@RankID,@UserName,'-',@Email,getdate(),getdate(),0,0,@approvedFlag,@ProviderUserKey)



Code:
ALTER PROCEDURE [dbo].[yaf_user_aspnet](@BoardID int,@UserName nvarchar(50),@Email nvarchar(50),@ProviderUserKey nvarchar(64),@IsApproved bit) as
BEGIN
      SET NOCOUNT ON

      DECLARE @UserID int, @RankID int, @approvedFlag int

      SET @approvedFlag = 0;
      IF (@IsApproved = 1) SET @approvedFlag = 2;     
     
      IF EXISTS(SELECT 1 FROM [dbo].[yaf_User] where BoardID=@BoardID and ([ProviderUserKey]=@ProviderUserKey OR [Name] = @UserName))
      BEGIN
            SELECT TOP 1 @UserID = UserID FROM [dbo].[yaf_User] WHERE [BoardID]=@BoardID and ([ProviderUserKey]=@ProviderUserKey OR [Name] = @UserName)

            UPDATE [dbo].[yaf_User] SET
                  [Name] = @UserName,
                  Email = @Email,
                  [ProviderUserKey] = @ProviderUserKey,
                  Flags = Flags | @approvedFlag
            WHERE
                  UserID = @UserID
      END ELSE
      BEGIN
            SELECT @RankID = RankID from [dbo].[yaf_Rank] where (Flags & 1)<>0 and BoardID=@BoardID

            INSERT INTO [dbo].[yaf_User](BoardID,RankID,[Name],Password,Email,Joined,LastVisit,NumPosts,TimeZone,Flags,ProviderUserKey)
            VALUES(@BoardID,@RankID,@UserName,'-',@Email,getdate(),getdate(),0,0,@approvedFlag,@ProviderUserKey)
     
            set @UserID = SCOPE_IDENTITY()
     
      END
     
      SELECT UserID=@UserID
END
GO
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.110 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET