I am creating a windows form object that will allow me to filter on the original set.
I have 2 datasets
dsOriginal //the original data, used so I can pull information many times and not be forced to call the db over and over again
dsNew //my filtered dataset
my function so far
Unfortunately if I run the above with textBox1.Text = "tes"; it should return 10 results but continues to return 0.
Does anybody see anything obvious that I am missing??
tia
I have 2 datasets
dsOriginal //the original data, used so I can pull information many times and not be forced to call the db over and over again
dsNew //my filtered dataset
my function so far
Code:
DataTable dtStuff = (DataTable)dsDataNew.Tables[0];//pull the datatable out of the dataset
DataView dvStuff = new DataView(dtStuff);//create a datavuiew
dvStuff.RowFilter = String.Format("{0} LIKE '%{1}%'", this.strSPText, textBox1.Text.Trim());//set the filter up
DataTable dt = dvStuff.Table.Clone();//copy the view back to a datatable
this.dsDataNew.Tables.Clear(); //clear the dataset
this.dsDataNew.Tables.Add(dt);//add the new datatable into the dataset
load_data();//load the data
Code:
private void load_data()
{
this.lbItems.Items.Clear();
foreach (DataRow dr in dsDataNew.Tables[0].Rows)
{
this.lbItems.Items.Add(dr[this.strSPText].ToString());
}
}
Unfortunately if I run the above with textBox1.Text = "tes"; it should return 10 results but continues to return 0.
Does anybody see anything obvious that I am missing??
tia