【问题标题】:How can I use SqlCommand for searching data with multiple input如何使用 SqlCommand 搜索具有多个输入的数据
【发布时间】:2020-06-17 06:24:14
【问题描述】:

enter image description here

我有一个如屏幕截图所示的数据表,我想搜索工厂和面板 Tog 编号以显示组和协调。

一开始我试过这个:

SqlCommand cmd = new SqlCommand("Select [Group],[Coordination] from [Table] where Plant ='" + txt1.Text + "'", con);

但是如何处理多个输入?

【问题讨论】:

标签: c# sql-server database sqlcommand


【解决方案1】:
SqlCommand cmd = new SqlCommand("Select [Group],[Coordination] from [Table] where Plant LIKE '%" + txt1.Text + "%' OR PanelTogNumber LIKE '%" + txt1.Text + "%'", con);

你可以试试。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2018-01-30
  • 2019-11-11
  • 1970-01-01
  • 2013-12-13
  • 1970-01-01
  • 2016-03-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多