关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
想改进这个问题?将问题更新为 on-topic对于堆栈溢出。
7年前关闭。
Improve this question
我在 asp.net Entity Framework 中使用 C# 和 LINQ to SQL。
当复选框被选中时,我想从数据库中显示“approvementState”列值为假的列表,并且当复选框未被选中时;然后获取记录哪些列批准状态为真。
html:
<asp:CheckBox runat="server" ID="cbInternsApproval" Text="View Approved Interns" AutoPostBack="True" Checked="False" OnCheckedChanged="cbInternsApproval_CheckedChanged"/>
C#代码:
protected void cbInternsApproval_CheckedChanged(object sender, EventArgs e)
{
if (cbInternsApproval.Checked)
{
using (PROJECT_DBEntities3 context=new PROJECT_DBEntities3())
{
var lst=(from f in context.FirstInternships
where f.approvementState==true // error in this line of code
select f).ToList();
}
}
}
但我收到错误:无法隐式转换类型'bool? bool 值。存在显式转换。
最佳答案
其中 f.approvementState == true
关于c# - 无法隐式转换类型'bool ?' to bool on "whereapprovmentState=true",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25675015/