Author: Eyeoperation | Posted on: 7/1/2010 4:54:27 AM | Views : 897

I created a table named Thread to store logged-on users' comments.  It has CommentId, Topic, Comment, CreatedTime and UserId columns. I made CommentId as the primary key and UserId as the foreign key to the UnserId in the Membership table aspnet_Users.
But when I insert those data into table Thread, I get an error "Cannot insert the value NULL into column 'UserId', table 'ASPNETDB.dbo.Thread'; column does not allow nulls. INSERT fails.The statement has been terminated." I have tried different ways to resolve this, but could not make the UserId in the table Thread match the UserId in table aspnet_Users. 
Yesterday, I found the Table Profile Provider Samples created by Hao Kung at http://www.asp.net/downloads/sandbox/table-profile-provider-samples. It should be be able to solve my problem.  But the code was written in C#.  Is t ...

Go to the complete details ...