find the position of an item in the middle of datarows

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

Haisheng Lin

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!


.
 
The binding context is your only option as it will provide you with the
requested functionality. As you state yourself, it's down to the "missing"
cursors, but you can obviously implement this yourself if you really need
it. What's the problem with the binding context?

--
Carsten Thomsen
Enterprise Development with Visual Studio .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Haisheng Lin said:
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!


.
 
Could you tell me more details about how to get
the position of a specific item using binding context?
-----Original Message-----
The binding context is your only option as it will provide you with the
requested functionality. As you state yourself, it's down to the "missing"
cursors, but you can obviously implement this yourself if you really need
it. What's the problem with the binding context?

--
Carsten Thomsen
Enterprise Development with Visual Studio .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Haisheng Lin said:
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]



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