private void txtSearch_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { if (this.GridView_Index == 1) { this.search = "select * from User where UserName Like '%" + txtSearch.Text + "%'"; } if (this.GridView_Index == 2) { this.search = "select * from Link where LinkName Like '%" + txtSearch.Text + "%'"; } if (this.GridView_Index == 3) { this.search = "select * from Comment where Comment Like '%" + txtSearch.Text + "%'"; } if (this.GridView_Index == 4) { this.search = "select * from ListGroup where GroupName Like '%" + txtSearch.Text + "%'"; } Function_Settings fnc = new Function_Settings(); fnc.search_value(this.search); fnc.search_item(Main_GridView, this.search); } }
private void btnFilter_Click(object sender, EventArgs e) { this.search = "SELECT Name, Time, Action,Note FROM Log WHERE Action LIKE '%" + cb1.Text + "%' and Time BETWEEN '" + "" + dateTimePicker1.Value.ToString() + "' AND '" + dateTimePicker2.Value.ToString() + "'AND Name LIKE '%" + cb2.Text + "%'"; Function_Settings fnc = new Function_Settings(); fnc.search_value(this.search); fnc.search_item(Log_GridView, this.search); }