Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Joe Yu
Starting Member
1 Post |
Posted - 2010-07-04 : 16:01:19
|
| I recently read Scott Mitchell's article series "Examining ASP.NET's Membership, Roles, and Profile". In Part 6http://www.4guysfromrolla.com/articles/101106-1.aspx, It says "to store additional, user-specific fields...If you are using the SqlMembershipProvider, this would mean creating an additional database table that had as a primary key the UserId value from the aspnet_Users table and columns for each of the additional user properties."I created a table named Thread to store some specific users information and comments they make. I set the ThreadId as the primary key and the UserId as the foreign key to the UserId in aspnet_Users table. But when I run the application and use a user's account to submit a comment, there is an error in my Comments.aspx.vb page "Cannot insert the value NULL into column 'UserId', table 'ASPNETDB.dbo.Thread'; column does not allow nulls. INSERT fails.The statement has been terminated."How can I make the logged-on user's UserId inserted into the Thread table when storing the user's other data information?Thanks.Joe |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2010-07-07 : 12:42:25
|
| show us your INSERT statement and the code before it where you capture the userID. you have to capture and pass the userID to the INSERT sproc, unless you are doing an inline SQL INSERT which is crappy<><><><><><><><><><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
 |
|
|
|
|
|