VB.NET and recordsets ...

  • Thread starter Thread starter Wim Van der Elst
  • Start date Start date
W

Wim Van der Elst

Hello,
I want to start working in VB.net but seem to have
trouble in understading how I get to an equivalent of a
recordset as in VB6.
The only examples I find are working with binding, but
that is not what I want to do.
I want to be able to create a recordset and go forward
and backwords through it and us it in while not .EOF
structure as I did befor in VB6.
How is this done in VB.NET. Any axemples out there?

Wim
 
that would be a dataset or a dataview

considering your remark about EOF you can use a dataset like this

dim ds as new dataset
'fill your dataset
dim r as datarow
dim i as integer

for each r in ds.tables(0).rows
i += cint(r(0))
next
 
Hi Wim,

It is not impossible to use a recordset, but strongly advices to do not.

With a dataset you can do the same as with a recordset. It is not so often
given as example, but I think the example I give you bellow works even
better than a recordset. This is an example as addition to Eric, but there
are so much possibilities to handle data, that I don't think there is
someone who knows them all.
I want to be able to create a recordset and go forward
and backwords through it and us it in while not .EOF
structure as I did befor in VB6.

Another example than EricJ
dim i as integer = currentrow

for a next
\\\\
if ds.tables(0).rows(i) < ds.tables.rowscount then
myitem = ds.tables(0).rows(i+1)("mydatabaseItem")
end if
///
for a previous
if i>0
myitem = ds.tables(o).rows(i-1)("mydatabaseItem")
end if
///
I think the rest you understand.

I hope this helps a little bit?

Cor
 
Hi mate,
i had trouble getting round this, got to accept the idea
of recordsets is replaced with datasets.
Similar to recordsets but improved as yuou can now have a
collection of tables rather than the 1 table.
Have a read on datasets (guess this is the inheritor of
recordsets from vb6)
regards

Adam
 
Hi Wim ,

In addition tho the posts already made. I suggest that you obtain an ADO.NET
book and read through. It's a little tough to start out but you will get
there. Also, for ADO type posts for .NET framework such as this one, you
really need to post to

microsoft.public.dotnet.framework.adnotnet

Regards - OHM
 
Wim,
To further OHM's comments, I find David Sceppa's book "Microsoft ADO.NET -
Core Reference" from MS Press to be an excellent resource for everything
ADO.NET. It is a easy read to learn ADO.NET, plus it is a good desk
reference while working with ADO.NET.

Hope this helps
Jay
 
Back
Top