Sorting & Filter Dataset

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hi All,

VB.NET, I have a dataset populater from a database.

I tried this
tempDS.Tables(0).Select("fldProjectStatusID=1", "fldJobName")

But it is not sorting or selecting, it still shows everything in the order
it was queried from the database in.



THanks

Lee
 
Hi Lee,

I have seen that also, it is strange that it gives no error.

The syntax is
dim drSelected() as datarow
drSelected() = tempDS.Tables(0).Select("fldProjectStatusID=1", "fldJobName")

I hope this helps?

Cor
 
I tried that and am getting a warning "Number of indices is less than the
number of dimensions of the indexed array" when run

It is allowing the program to execute, although not sorting or filtering the
dataset. The dataset is not populated until runtime using programming (not
the controls)
 
Lee:

Does the table have a primary key? I believe fldProjectStatus would need to
be unique (PK) for this to work.

If it's not a key and you don't want it to be, you could use a DataView and
use Sort to sort things or set the RowFilter for instance to find the
records if they are there...
http://www.knowdotnet.com/articles/dataviewsort.html
HTH,

Bill
 
Yes the primary key is fldProjectID

The SQL statement that populates the dataset does an inital sort on that
field, then moves it into the dataset. Once it's displayed in the datagrid
from the dataset the use needs to be able to click on the field headings to
sort by fldProjectID or fldProjectCompany

I've scaled it back to one table (the inital SQL called from 3 tables) just
to try and get it working.
 
Ok read your article there, looks like that will work (I just want something
to work at this point)

However my question to you is how do I populate the datatable? I'm totally
new to ADO.NET here so any code including the SQL hit to the DB would be
appericated.

Thanks

Lee
 
Back
Top