I’ve got a DataSet in C# in which I have a row count to textbox9 but I would like to filter it so that it only counts where the Status='Closed'. I can do this using a SQL statement before it goes to the DataSet but I want to put all the data into a single DataSet and then just filter that instead.
MyCommand = new OleDbDataAdapter("SELECT * FROM [CR$]'", MyConnection);
DataSet dtSet = new System.Data.DataSet();
MyCommand.Fill(dtSet);
bindingSource1 = new BindingSource();
bindingSource1.DataSource = dtSet;
bindingSource1.DataMember = dtSet.Tables[0].TableName;
dataGridView1.DataSource = bindingSource1;
textBox9.Text = dtSet.Tables[0].Select("Status='Closed'");
1 Answer