DataGridView filter
-
I have a DataGridView bound to a table in Sql Server CE. I'd like to filter results but I couldn't figure it out so far. I'm trying to use DataView RowFilter but I couldn't manage it to work. Could you please tell me what should I look for? Here's the code, auto-generated by VS.NET, to bind data:
this.gridRecords.DataSource = this.RecordsBindingSource;
this.RecordsBindingSource.DataMember = "Records"; //table name is Records
this.RecordsBindingSource.DataSource = this.tempRecordsDataSetBindingSource;
this.tempRecordsDataSetBindingSource.DataSource = this.tempRecordsDataSet;
this.tempRecordsDataSetBindingSource.Position = 0;
this.tempRecordsDataSet.DataSetName = "TempRecordsDataSet";
this.tempRecordsDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.RecordsTableAdapter.ClearBeforeFill = true;
this.RecordsTableAdapter.Fill(this.tempRecordsDataSet.Records);This is what I tried:
this.tempRecordsDataSet.Records.DefaultView.RowFilter = "Field = 1234567891";
-
I have a DataGridView bound to a table in Sql Server CE. I'd like to filter results but I couldn't figure it out so far. I'm trying to use DataView RowFilter but I couldn't manage it to work. Could you please tell me what should I look for? Here's the code, auto-generated by VS.NET, to bind data:
this.gridRecords.DataSource = this.RecordsBindingSource;
this.RecordsBindingSource.DataMember = "Records"; //table name is Records
this.RecordsBindingSource.DataSource = this.tempRecordsDataSetBindingSource;
this.tempRecordsDataSetBindingSource.DataSource = this.tempRecordsDataSet;
this.tempRecordsDataSetBindingSource.Position = 0;
this.tempRecordsDataSet.DataSetName = "TempRecordsDataSet";
this.tempRecordsDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.RecordsTableAdapter.ClearBeforeFill = true;
this.RecordsTableAdapter.Fill(this.tempRecordsDataSet.Records);This is what I tried:
this.tempRecordsDataSet.Records.DefaultView.RowFilter = "Field = 1234567891";