Search in Dataset

  • Thread starter Thread starter Haisheng Lin
  • Start date Start date
H

Haisheng Lin

I have a table with two columns:
prod_id (primary key), prod_name.

I filled my dataset with this table and bind
two textboxs to the two columns.
I am trying to search a specific product
using its prod_name and I want to know
the position of this row in datatable.rows.

How can I do it?

Thank you!
 
There might be a functionality to do this, but I have seen people work
around very easily by putting another column called "rowindex" which
keeps the index stored there. [inefficient, but works]

Rahul Singh

anant systems, inc. | making information work for you

anantsystems.net | ioserver.net [Developer and Business .NET Hosting]
 
But users need to add and deletes products.
You mean I have to keep track of these indexes?

In vb6, I use adodc and bind the fields to textbox.text.
If I need to find the specific item, I just use
adodc.recordset.find, then the cursor will move to
the first occurence and textbox.text will show the
the item you need. But in ado.net, there is no cursor in
dataset. You have to use the position in bindcontext.
If you just need to go through items one by one, that is
ok, you just add one or subtract one from the position.
But if you need to find an item in the middle,
how can you know the position you need to move to?
Do I need to implement those search algorithems myself?


-----Original Message-----
There might be a functionality to do this, but I have seen people work
around very easily by putting another column called "rowindex" which
keeps the index stored there. [inefficient, but works]

Rahul Singh

anant systems, inc. | making information work for you

anantsystems.net | ioserver.net [Developer and Business .NET Hosting]



Haisheng Lin said:
I have a table with two columns:
prod_id (primary key), prod_name.

I filled my dataset with this table and bind
two textboxs to the two columns.
I am trying to search a specific product
using its prod_name and I want to know
the position of this row in datatable.rows.

How can I do it?

Thank you!


.
 
Back
Top