Home All Groups Group Topic Archive Search About

Cant seem to filter Dataset table by a value

Author
6 Nov 2006 3:37 AM
mike11d11
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

Author
6 Nov 2006 4:44 AM
Cor Ligthert [MVP]
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
>
Author
6 Nov 2006 9:55 AM
Michel Posseth [MCP]
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
>
>
Author
6 Nov 2006 5:47 PM
Cor Ligthert [MVP]
Was the same answer
:_)

Cor

Show 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
>>
>>
Author
6 Nov 2006 7:58 PM
mike11d11
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?
Author
7 Nov 2006 4:22 AM
RobinS
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?
>
Author
7 Nov 2006 4:33 AM
Cor Ligthert [MVP]
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?
>