Filter data in dataset
-
I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)
-
I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)
You should be able to use the Select property to filter by col22<=0...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
You should be able to use the Select property to filter by col22<=0...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Thank you But i want to filter rows in Table 1 and the col22 columns is in table2 How to use select property in this case : Me.dataset.Table1.select ( "Col22>=0" ) - This cause an error ???
mysybet123 wrote:
Me.dataset.Table1.select ( "Col22>=0" )
Is it
Me.dataset.Table(1).Select("Col22>=0")
what is the error? Make sure 'Col22' is there in your dataset's table 1.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
-
I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)
Hi, Try to add an expression column to table 1 (for more details go to http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression(vs.80).aspx[^]) and assign it the following expression Count(child(RelationName).FieldName) Thus you can use the select statement of DataTable or a DataView object Note: You must have a relationship between tables Hope this helps :)
NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice...
-
mysybet123 wrote:
Me.dataset.Table1.select ( "Col22>=0" )
Is it
Me.dataset.Table(1).Select("Col22>=0")
what is the error? Make sure 'Col22' is there in your dataset's table 1.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.