By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,318 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,318 IT Pros & Developers. It's quick & easy.

Cant seem to filter Dataset table by a value

P: n/a
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.WorkLis t)

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

Nov 6 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Mike,

I have answered this in another newsgroup,

Cor

"mike11d11" <mi*******@yahoo.comschreef in bericht
news:11*********************@h48g2000cwc.googlegro ups.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.WorkLis t)

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

Nov 6 '06 #2

P: n/a

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.WorkLis t)

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

Nov 6 '06 #3

P: n/a
Was the same answer
:_)

Cor

"Michel Posseth [MCP]" <Mi**************@discussions.microsoft.comschre ef
in bericht news:3D**********************************@microsof t.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.WorkLi st)

MsgBox(Me.AccuLogic_SQLDataSet.WorkList.Rows.Coun t)
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


Nov 6 '06 #4

P: n/a
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?

Nov 6 '06 #5

P: n/a
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.
"mike11d11" <mi*******@yahoo.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.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?

Nov 7 '06 #6

P: n/a
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

"mike11d11" <mi*******@yahoo.comschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.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?

Nov 7 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.