private void gridQueryAndReload()
{
if (ds.Tables.Count > 0)
{
string strSearch = this.txtSearch.Text.Trim();
string[] strParam = new string[2];
DataView dv = ds.Tables[0].DefaultView;
string strQuery = "";
strParam[0] = strSearch.Replace("'", "''").Replace("*", "").Replace("[", "]");
strParam[1] = this.txtIDNumber.Text.Trim();
try
{
strQuery = string.Format(@"([{1}] like '{0}%')
", strParam);
dv.RowFilter = strQuery;
}
catch (Exception ex)
{
this.txtSearch.Focus();
}
this.dataGridView1.DataSource = dv;
}