0

我有一个网站,用户可以发帖。他们最多可以有10 个独特的帖子。我有 10 个数据库字段,它们是 post_1,post_2 ... post_10 ,如果 post_# 为空,那么它将为空 我如何使用实体循环 post_1 -> post_10 并计算如果没有帖子,那么有多少空值是 Null 我可以阻止另一个帖子的发生。所有 Post_# 都是可为空的 INT

// here i check for the RegistrationID and the first 2 Post_#
// however this code is wrong as I want to loop post 1-10 and get the Null Count
 var getlistings = (from s in db.posters where getid.RegistrationID == s.RegistrationID && s.Post_1 == null && s.Post_2== null select s.RegistrationID).Count();

知道如何解决这个问题吗?

4

0 回答 0