【发布时间】:2015-04-13 15:17:07
【问题描述】:
我有一个复选框列表,提交时将选择存储在带有用户 ID 的表中。该表如下所示:
Create table tblInterestByUserId
(
Id int primary key identity,
UserId varchar(10),
SubInterestId int,
SubInterest varchar(20),
InterestId int
)
现在我想根据 SubInterestId 在另一个页面上的另一个复选框列表上检索选择。我想在新页面上做这样的事情:
1.遍历 tblInterestByUserId 中所选 UserId 中所有插入的 SubInterest 行。 2.根据 tblInterestByUserId 中已存在的 SubIinterest 为该 UserId 填充复选框列表
请帮助我在 Page_Load 上使用相同的代码隐藏。
【问题讨论】:
-
也许有一个 select 语句?
-
我知道我必须使用 select 语句。我对使用 Read 循环或其他什么东西感到困惑?我需要一个开始。
-
您为什么要在此表中保留
SubInterest varchar(20)?它应该在另一个表中,并且在这个表中只有它的 id -
它是用于不同的目的。不能有任何其他表。忽略其他列。唯一关心的是 UserId 和 SubInterestId
-
是的,您可以使用 Read 循环
标签: asp.net sql-server checkboxlist