c# - 使用 LINQ 查询填充 DropDownList
问题描述
我想在其中查看此查询,DropDownList
但结果将如下所示
{family=jac}
var show = (from u in database.tbl_Customer
where u.moaref == session
select new { u.Family }).ToList();
DropDownList1.DataSource = show;
DropDownList1.DataBind();
解决方案
投影Family
而不是匿名对象:
var show = (from u in database.tbl_Customer
where u.moaref == session
select u.Family).ToList();
推荐阅读
- python - Pandas:将多索引级别转换为一组新的列
- python - pd.to_datetime 好的,但仍然不是情节中的日期
- android - 按钮未填充父容器高度
- python - 使用 pyinstaller 转换为 exe 时出现 Moviepy 模块错误
- azure - 在 azure blob 存储容器中,我可以使搜索功能(文件夹)不区分大小写吗
- css - CSS 视差:“溢出:隐藏;” 在 iOS 上打破 3D 变换/透视
- kotlin - 如何在 Kotlin 中使用 okhttp3 进行气流实验 api?
- node.js - 如何修复 NPM
- node.js - 使用反应和节点的 PUT 请求错误( net::ERR_CONNECTION_RESET )
- python - 在特定索引处连接两个多维 numpy 数组