Web Forms Single Record Data Navigation

  • Thread starter Thread starter Trevor Fairchild
  • Start date Start date
T

Trevor Fairchild

Hello all - I've been working in VB6 for about a year and
now I've moved "up" to VB.NET. I think I would have fewer
problems in learning vb.net if I knew nothing about
previous versions of vb...

I have spent a long time now trying to figure out how to
move from one record to another in a vb.net application.
For some reason, Microsoft is big on using Datagrids and
DataTables and so all of their examples cover how to
display the entire contents of a dataset at one time. I,
of course, don't want that - after much hunting, I finally
found the command to navigate from one record to the next
in a dataset - me.bindingcontext

I was ecstatic - finally I could do what I needed to - all
I had to do was use the same code into a Web
Application... :(

Of course, there is no bindingcontext object for a web
application because the entire contents of the dataset is
copied to the client (apparently...) and so there is no
specific position property to reference.

I have been reading and searching online once again and
have only been able to find a rather simplistic reference
in MSDN that you just have use the dataset to change which
record is being displayed - but no reference to how to
actually do that.

Can anyone help me? It is such a simple thing, I just
don't seem to be able to think of the right word to seach
by.

In the old days, using vbscript, I would just
dim rs
set rs = CreateObject("ADODB.recordset")
rs.open """""
rs.movenext
rs.movelast, etc, etc.

I can bind all of my controls to the appropriate text
boxes, I figured out the Page.DataBind() method to execute
the binding at run-time, everything works, I just can't
move any other record other than the first one in the
dataset.

Can somebody please help me?

Thanks,
Trevor
 
Trevor:

"I feel your pain" - believe me. I didn't know VB6, I taught myself VB.NET
after programming in FoxPro-DOS for quite some time - always wished I knew
VB6 so who knows who has it easier!?

(FYI: Gartner Research says it takes a COBOL programmer 12-18 months to
learn the new stuff.)

Anyhow I was able to address single records as follows in this example:

result = mycommand.executereader(params) - loads "result" with a dataset
from somewhere (SQL,etc)

while result.read

myIntVar = result.GetInt16(0) * first item returned is an
integer (0)
myStringVar = result.GetString(1) * second item is a string (1)

end while

You can devlop the logic to find a particular record.

I hope that this helps you - KEEP GOING - it IS worth it!

Good Luck,

Fred
 
Back
Top