I have a problem when Im trying to leave a comment on the new post. I made a two tables one is for new post and one is for new comments.
New post table looks like : NewPostId-PrimaryKey, UserId, Subject, BodyPost and DatePost
New Comment table : NewCommentId-PrimaryKey, NewPostId, UserId, BodyComment, DateComment,
I have created a relation Between a NewPost table(UserId) + Asp_User(UserId) and NewComment table(NewPostId) + NewPost table(NewPostId)
When a want to leave a new comment the error comes up as can not istert a null value into NewPostId in NewComment table.
How should looks a correct code bellow?? Or any ideas how could i sort it out ?? Thanks a lot
MembershipUser currentUser = Membership.GetUser();
Guid currentUserId = (Guid)currentUser.ProviderUserKey;
string connectionString = ConfigurationManager.ConnectionStrings["PostConnectionString"].ConnectionString;
string insertSql = "INSERT INTO NewComment(BodyComment, UserId, NewPostId) VALUES (@BodyComment, @UserId, @NewPostId)";
using (SqlConnection myConnection = new S
View Complete Post