【发布时间】:2013-02-02 23:15:44
【问题描述】:
我想在按下搜索按钮时从文本框中获取字符串,然后我想突出显示放置该数据网格的行。我相信这是可能的。我不知道如何做到这一点。请帮帮我。
string query = " SELECT * FROM suboffice where so_id like '%" + sor_id.Text + "%' ";
SqlConnection objConn = new SqlConnection(connectionString);
objConn.Open();
SqlDataAdapter subofficeTableAdapter1 =new SqlDataAdapter(query,objConn);
SqlCommandBuilder cBuilder = new SqlCommandBuilder(subofficeTableAdapter1);
DataTable dTable = new DataTable();
subofficeTableAdapter1.Fill(dTable);
dataGridView1.DataSource = dTable;
subofficeTableAdapter1.Update(dTable);
当我在运行时将任何内容放入其中时,sor 是一个搜索选项卡,我的数据网格视图会更新。这个程序是用c#制作的
【问题讨论】:
-
试试这个:1) 谷歌 2) Stackoverflow 搜索 3) 如果两者都没有给出问题,请用代码发布问题...stackoverflow.com/questions/6210781/…stackoverflow.com/questions/6989242/…stackoverflow.com/questions/797946/…
-
什么类型的应用程序?表格? wpf? asp.net?
-
注意:你的代码适合sql注入!!
标签: c# datagridview