Question on Dataset navigation vb.net

N

Newbie

Could someone answer a vb.net database question? what is a good
way to code a form so that a user could navigate through a dataset ie:
MoveFirst, MoveNext, MovePrevious, MoveLast, Update and Delete records
and have an option to find a record. I have been able to figure out
how to navigate both using bound and unbound controls. But I can't
figure out how to do the Navigation and find a record at the same time.
Do most people use one connection, dataAdapter, Dataset for browsing a
table and then if a user wishes to Search for a unique record do you
close the first dataset and open another using a sql string like
"SELECT * FROM datatable WHERE PK = ?" What has me confused with that
idea is if a user found a record using the some type of (search)
dataset routine, how do I set up the program so that the user can just
click MoveNext again and movenext or moveprev from that record that
he/she just was viewing?


Thanks


Newbie
 
C

Cyril Gupta

You have asked a question that has a really big answer if someone tries to
explain it.

But in short...

VB retrieves all of the records you ask for in one go, so there is no
question of movewhatever.

Use the Row property of the DataTable in your DataSet and set the Index
number of your ROw to access individual rowdata. this a collection, so it's
gonna be easy.

Here's a sample codett that retrieves all the rows from the datatable

Dim dRow as datarow
for each drow in mydatatable.rows
console.writeline drow.item("myfield")
next

Cyril
 
C

Cyril Gupta

Cor,

It's amazing how much .Net has. I didn't know that CurrencyManager existed.
It sounds like a pretty interesting thing.

Thanks
Cyril
 
N

Newbie

Thanks for the info guy's, I guess I should not have made the question
so broad, what I should have asked is would it be better to use unbound
controls vs bound controls. I can see using bound controls will be
faster in development but you lose control with what you can do. In
the above question I am looking at creating a form with text box's that
display fields from a dataset. I wanted to give a user the ability to
navigate through the dataset using MoveFirst, MoveNext buttons but also
offer a search option. I will look into the CurrencyManager for more
ideas

Thanks

Newbie
 

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