How to find a record in a dataset?

G

Guest

Hi,
How can I find a record in a dataset. I have 1 textbox name txtfind.
my sql statement should be like this.."select * from employees where emp_id= txtfind.text" then if found it should bind the fields to the corresponding textboxes on the form.
 
S

scorpion53061

You can use a datatable.select or prefably Use a dataview like in this
example provided by Cor or this link from Bill Ryan
http://www.knowdotnet.com/articles/advancedrowfilter.html

See below this for example of datatable.select
------------------------

Hi Gene,

In addition to Jay B.

I also suggest to use the dataview.
\\\
dim dv as new dataview(mydataset.tables("mytable")
dv.rowfilter = "mysortitem < 100"
dv.sort = "mysortitem"
mycombobox.datasource = dv
mycombobox.displaymember = "xx"
///
This give you with a miniumum of code the maximum results in my idea.

Cor
-------------------------

Or datatable.Select example from BinSong....
---------------

Hi, Stu

Can you try this:
DataRow[] drReviewers = ReviewerDS.Tables["Menu"].Select("","MenuItem");
ReviewerMenu.DataSource = drReviewers;
ReviewerMenu.DataBind();
If not working, You might try the following because you are sorting only
instead of filtering and sorting:
DataView dvReviewer = ReviewerDS.Tables["Menu"].DefaultView
dvReviewer.Sort = "MenuItem"
ReviewerMenu.DataSource = dvReviewer;
ReviewerMenu.DataBind();
Hope this helps

Bin Song, MCP
 

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