DataSet - what is the best way

  • Thread starter Thread starter web1110
  • Start date Start date
W

web1110

I have a SQL table that has a bunch of data in it. For a particular
execution, some subset of that data is is relevant and is downloaded into a
DataSet table. Now, all the information is available.

At different times during program execution, various rows from the table
will need to be referenced. The accessing order is random. The data is
accessed via unique keys in the table.

What is the best way to accomplish this?

A. Is there a way for me to perform queries on the DataTable? I'm not
aware of this capability.
B. Should I unload the table into a sorted list indexed by the key - I
tink this is the solution I need?
C. Always query the database for the required row - wasteful and
unnecessary.
 
Web11110

You can use

The datatable.select (returns a datarowcollection)
The dataview.rowfilter (filters the datatable by the filter)
The dataview.find (return an index to a datarowview)
The datarowcollection.find (returns one datarow by the primarykey)

I hope this helps,

Cor
 
Thanx, this is the course I need to follow.

I am playing with the NorthWind database using the employes table. I have
the table resident in the DataSet and assigned as DataView to the table.

But I am having a problem getting all the rest of the pieces together.

The rowfilter filters OUT everything that MATCHES the condition, right? So
I want to negate the key I want to retrieve.

For instance,

dataView1.RowFilter="EmployeeId != '2'";

Givesme the error:

Cannot interpret token '!' at position 12.

I can use a little help getting all the parts together.

Thanx,
Bill
 
Back
Top