473,509 Members | 8,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cant seem to filter Dataset table by a value

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
6 1534
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

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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6593
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
4
15161
by: Hardy Wang | last post by:
Hi all: I have a DataSet populated with values. How can I return ds.Tables.DefaultView's records from a starting number to a ending number? For example, I have 100 records in the DefaultView, but...
1
8792
by: SPG | last post by:
Hi, I need to be able to filter the columns that are visible through a dataset. That is, I can have all columns in a dataset, but only some of them are visible when filtered. I know you can...
1
1722
by: werk | last post by:
For limiting access to the database to strictly necessary I try to filter the query by using DataView. Thw DataSet ds contains three columns (fields) : (LAND_ID, Landcode, Landnaam) and four...
3
11430
by: Vern | last post by:
The following code retrieves data into a dataset, and then creates a dataview with a filter. This dataview is then attached to a combobox. When the effective date changes, I would like to see the...
4
1613
by: Bo Diddly | last post by:
This is what I've done so far: I have a DataBase with: tblBook BookID... key Book... All the book titles of the Bible tblChapter ChapterID... key Chapter... chapter numbers (1 - 150)
16
1762
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
2
8807
by: Anandan | last post by:
Hi, In our Project we use Dataset to load the Grid with Values. We have some criteria to filter the values to be shown in the Grid. For that we used the SELECT command to filter the Same...
2
5579
by: Raymond Chiu | last post by:
Dear all, If I have the dataset, What the code should be to filter records in the dataset by some fields criteria? Is it like a SQL? Thanks for your help,
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.