linq查询与组合框 [英] linq query with combobox

查看:89
本文介绍了linq查询与组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个组合框,其中包含Table1列的名称,我想在linq查询中使用combobox.text来使查询更易于搜索,我的意思是这样的

var Q =来自表1中的s其中s。+ combobox1.text +包含(textbox1.text)选择s

请更正此查询。谢谢

解决方案

var Q =来自表1中的s,其中s [colName] + combobox1.text == textbox1.text

select s;

I have a combobox that containing names of columns of Table1 and i want to use combobox.text in linq query to make the query more searchable i mean like this
var Q=from s in Table1 where s.+ combobox1.text+ contains ( textbox1.text) select s
please correct this query. thanks

解决方案

var Q=from s in Table1 where s[colName]+ combobox1.text == textbox1.text
select s;


这篇关于linq查询与组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆