- Home
- »
- C# Language
- »
- search form_number in datagridview through textbox
AuthorQuestion
search form_number in datagridview through textbox
Posted on 04 Feb 2015
Posted on 04 Feb 2015
i am success in searching name in datagridview using query..
but not idea for serching number in datagridview
i want to search form_number in datagridview
can any one give me that query pattern
in that LIKE operator is not working.....
but not idea for serching number in datagridview
i want to search form_number in datagridview
can any one give me that query pattern
in that LIKE operator is not working.....
AuthorReply
Abhijit Patil - 1
- 0
Re: search form_number in datagridview through textbox
Posted on 04 Feb 2015
Posted on 04 Feb 2015
hey asmita,
can you elobrate your question please .then we understand what exazactly you want .then we provide correct solution.
hope you understand
can you elobrate your question please .then we understand what exazactly you want .then we provide correct solution.
hope you understand
thanks and Regards,\ Abhijit Patil dotnetbyabhipatil.blogspot.in
asmita patil - 0
- 0
Posted on 04 Feb 2015
private void txt_frm_filter_value_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (cmb_frm_filter_search_type.SelectedItem.Equals("Form no."))
{
BindingSource bs = new BindingSource();
bs.DataSource = dgv_emp_search.DataSource;
bs.Filter = dgv_emp_search.Columns[0].HeaderText + "Like " + Convert.ToInt32(txt_frm_filter_value.Text) + " ";
//bs.Filter = dgv_emp_search.Columns[0].HeaderText = Convert.ToUInt64(txt_frm_filter_value.Text);
// if (dgv_emp_search.Columns[0].Equals(searchValue))
//bs.Filter = dgv_emp_search.Columns[0].HeaderText.ToString() + " LIKE '%" + Convert.ToInt32(txt_frm_filter_value.Text) + "%'";
dgv_emp_search.DataSource = bs;
//valueResulet = false;
}
else if (cmb_frm_filter_search_type.SelectedItem.Equals("First name "))
{
BindingSource bs = new BindingSource();
bs.DataSource = dgv_emp_search.DataSource;
bs.Filter = dgv_emp_search.Columns[1].HeaderText.ToString() + " LIKE '%" + txt_frm_filter_value.Text + "%'";
dgv_emp_search.DataSource = bs;
}
}
}
txt_frm_filter_value is the name of textbox
cmb_frm_filter_search_type is name of combobox where we can select a search type like first name, last name, and form number
now my problem is : in my datagridview lots of record will be come from different tables , that is employee form number wise...
so i want to search directly form number in datagridview..
i cant search form number in datagridview..
my query is not set valid....
Piyush PansuriyaPosted Feb 4, 2015, 7:14 AM
Use "=" instead of LIKE and remove ' (single quotations) and '%' from query. and search with your number column.