|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cant seem to filter Dataset table by a valueCan someone tell me why I still have the same amount of rows after I use this filter select option. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WorkListTableAdapter.Fill(Me.SQLDataSet.WorkList) MsgBox(Me.AccuLogic_SQLDataSet.WorkList.Rows.Count) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") End Sub Mike,
I have answered this in another newsgroup, Cor Show quoteHide quote "mike11d11" <mike11***@yahoo.com> schreef in bericht news:1162784252.050067.57070@h48g2000cwc.googlegroups.com... >I cant seem to filter down my dataset table by criteria in expression. > Can someone tell me why I still have the same amount of rows after I > use this filter select option. > > > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > > Me.WorkListTableAdapter.Fill(Me.SQLDataSet.WorkList) > > MsgBox(Me.AccuLogic_SQLDataSet.WorkList.Rows.Count) > > > End Sub > > > > Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Button2.Click > > Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") > > End Sub > That is because
Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") will return a array of datarows so you use this filetr like this for each dr as datarow in Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") debug.writeline(dr.item(0)) next You might consider using a dataview wich gives you some more flexibility with databinding regards Michel Posseth [MCP] Show quoteHide quote "mike11d11" wrote: > I cant seem to filter down my dataset table by criteria in expression. > Can someone tell me why I still have the same amount of rows after I > use this filter select option. > > > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > > Me.WorkListTableAdapter.Fill(Me.SQLDataSet.WorkList) > > MsgBox(Me.AccuLogic_SQLDataSet.WorkList.Rows.Count) > > > End Sub > > > > Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Button2.Click > > Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") > > End Sub > > Was the same answer
:_) CorShow quoteHide quote "Michel Posseth [MCP]" <MichelPosseth***@discussions.microsoft.com> schreef in bericht news:3D634812-0B76-41BD-B935-46DE1BE44BBA@microsoft.com... > > That is because > > Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") > > will return a array of datarows > > so you use this filetr like this > > for each dr as datarow in Me.SQLDataSet.Tables("WorkList").Select("DSK = > '999'", "DSK") > > debug.writeline(dr.item(0)) > > next > > You might consider using a dataview wich gives you some more flexibility > with databinding > > > regards > > Michel Posseth [MCP] > > > > > "mike11d11" wrote: > >> I cant seem to filter down my dataset table by criteria in expression. >> Can someone tell me why I still have the same amount of rows after I >> use this filter select option. >> >> >> >> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles MyBase.Load >> >> Me.WorkListTableAdapter.Fill(Me.SQLDataSet.WorkList) >> >> MsgBox(Me.AccuLogic_SQLDataSet.WorkList.Rows.Count) >> >> >> End Sub >> >> >> >> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles Button2.Click >> >> Me.SQLDataSet.Tables("WorkList").Select("DSK = '999'", "DSK") >> >> End Sub >> >> I'm trying to get to where I can filter down my datatable to see
specific records. Instead of the debug line, what code could i use to view only these accounts. I tried taking these rows and adding them to another table but it gives me an error saying these rows already belong to a table? Are you using data binding? You can easily filter
it with the associated binding source. myBindingSource.Filter = "DSK = '999'" Or create a DataView object (which is bindable, by the way) and then filter it: Dim myDataView = New DataView(SQLDataSet.Tables("WorkList")) myDataView.Filter = "DSK = '999'" I think if you want to read through the rows of the DataView, you have to cast it as a table using the ToTable method. Hope that helps. Robin S. Show quoteHide quote "mike11d11" <mike11***@yahoo.com> wrote in message news:1162843126.852055.164490@e3g2000cwe.googlegroups.com... > I'm trying to get to where I can filter down my datatable to see > specific records. Instead of the debug line, what code could i use to > view only these accounts. I tried taking these rows and adding them to > another table but it gives me an error saying these rows already belong > to a table? > Mike,
You never can add rows from one table to anothere. The datarows have themselves no description of the items, those are in the datacolumns. The only thing you can do is make a datatable.copy and than filter that one, Cor Show quoteHide quote "mike11d11" <mike11***@yahoo.com> schreef in bericht news:1162843126.852055.164490@e3g2000cwe.googlegroups.com... > I'm trying to get to where I can filter down my datatable to see > specific records. Instead of the debug line, what code could i use to > view only these accounts. I tried taking these rows and adding them to > another table but it gives me an error saying these rows already belong > to a table? >
Scope misunderstanding
Examples of VB.net commercial software packages Visual Basic 2003 won't run - get error message regex.replace and trim Dynamically changing button label from a variable set itemheight in listbox Filling TreeView with Recursive Function ? Application.EnableVisualStyles() still required in version 2.0 Initialize DefaultPropertyAttribute for a Object property Open files in associated editors. |
|||||||||||||||||||||||