473,586 Members | 2,682 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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.WorkListTabl eAdapter.Fill(M e.SQLDataSet.Wo rkList)

MsgBox(Me.AccuL ogic_SQLDataSet .WorkList.Rows. Count)
End Sub

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

Me.SQLDataSet.T ables("WorkList ").Select(" DSK = '999'", "DSK")

End Sub

Nov 6 '06 #1
6 1538
Mike,

I have answered this in another newsgroup,

Cor

"mike11d11" <mi*******@yaho o.comschreef in bericht
news:11******** *************@h 48g2000cwc.goog legroups.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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.WorkListTabl eAdapter.Fill(M e.SQLDataSet.Wo rkList)

MsgBox(Me.AccuL ogic_SQLDataSet .WorkList.Rows. Count)
End Sub

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

Me.SQLDataSet.T ables("WorkList ").Select(" DSK = '999'", "DSK")

End Sub

Nov 6 '06 #2

That is because

Me.SQLDataSet.T ables("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.T ables("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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.WorkListTabl eAdapter.Fill(M e.SQLDataSet.Wo rkList)

MsgBox(Me.AccuL ogic_SQLDataSet .WorkList.Rows. Count)
End Sub

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

Me.SQLDataSet.T ables("WorkList ").Select(" DSK = '999'", "DSK")

End Sub

Nov 6 '06 #3
Was the same answer
:_)

Cor

"Michel Posseth [MCP]" <Mi************ **@discussions. microsoft.comsc hreef
in bericht news:3D******** *************** ***********@mic rosoft.com...
>
That is because

Me.SQLDataSet.T ables("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.T ables("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(ByVa l sender As System.Object, ByVal e As
System.EventAr gs) Handles MyBase.Load

Me.WorkListTab leAdapter.Fill( Me.SQLDataSet.W orkList)

MsgBox(Me.Accu Logic_SQLDataSe t.WorkList.Rows .Count)
End Sub

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventAr gs) Handles Button2.Click

Me.SQLDataSet. Tables("WorkLis t").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(SQLDat aSet.Tables("Wo rkList"))
myDataView.Filt er = "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*******@yaho o.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.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*******@yaho o.comschreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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
6600
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 the text value is on a different table. The me.filter is then a text instead of the id-number from the lookup table. This causes the report to prompt...
4
15170
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 I just need records from 25th to 50th. Thanks for any suggestion! --
1
8796
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 use rowfilter on a dataview. Is there anything like that I can use? Steve
1
1731
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 rows. I try to filter out only one country (key is LAND_ID) with the following code: DataTable dt = ds.Tables; // ds contains the dataset of the...
3
11436
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 newly filtered data without having to create a new dataview each time. Is that possible? Also, do I need to attach the dataview to the combo box...
4
1620
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
1771
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 System.Data.SqlClient.SqlDataAdapter(sql, conn) Dim ds As New DataSet() da.Fill(ds) ComboBox1.DataSource = ds.Tables(0) ComboBox1.DisplayMember = "Lender"...
2
8818
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 Dataset. The SELECT Command we are using is as follows DS.Tables(0).Select("FieldName = '" & input value & "')
2
5583
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
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8202
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.