Filling a Dataset

S

Sid Price

I have Dataset that I need to filter into another Dataset for display and I
can not find out how to do this. I have found methods for copying a Dataset
but I can not see how to filter the rows copied using my query.

I hoped to be able to use a DataAdaptor to do this but SelectCommand
requires a connection and I don't see how to create a connection to my
Dataset object.

Any pointers would be much appreciated.
Sid.

(VB.NET 2003)
 
R

RobinS

You can use a dataview of the table for display.

dv = New DataView()
dv.Table = ds.Tables("Customers")
dv.RowFilter = "Country = 'USA'"

Then use the dataview to display.

You can also copy the dataview to a new table using dv.ToTable.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
S

Sid Price

Robin,

DataView.ToTable is not a defined method ... I am using VB.NET 2003.

I don't see any way to get the filtered data from the DataView into my new
Dataset.

Sid.
 
G

Guest

Sid,

Why do you need to get the data into a new dataset/datatable?

Just use the filtered dataview for display, that's what it is for.

The "ToTable" method is new in .Net 2.0, but you should not need it for
display purposes.

Kerry Moorman
 
S

Sid Price

Kerry,

The application does its data processing using a Dataset in many areas. This
particular Dataset is built from an imported CSV rather than a database,
which is where many other Datasets come from. We do not want to duplicate
the functionality of our application to process this imported data, we want
to use the code that already exists, i.e. the code that expects data input
from a Dataset. It is not simply a matter of display.

Sid.
 
P

PFC Sadr

import it into a database and learn how to use a ****ing where clause.

Datasets are for goddamn retards, if datareaders are faster and you're
not using them then you're not putting your customers first
 
R

RobinS

Well, can you filter it and then move the rows from one dataset to the
other one one-by-one? That's about all I can think of, the "brute force"
method.

Robin S.
----------------------------------------
 
S

Sid Price

This looks promising, thanks Kerry. I will be looking at this approach
later,
Sid.
 
S

Sid Price

Kerry,

Thank you so much for the link, it pointed me in the correct direction to a
resolution of my issue.

Sid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top