By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Class to use VB6-style access of VB.Net data objects

P: n/a
Greetings!

It seems to me that .Net is much more typing-intensive than VB6 was.
Instead of getting a recordset and reading a value from it using something
like "Name = MyRecordset("name")", I have to say something like "Name =
MyDataset.Tables(0).Rows(0)("Name")". I am tempted to write a class that
would inherit from DataSet and would provide the same interface that the VB6
RecordSet object did. It would have to have MoveFirst, MoveNext, EOF, and
BOF methods and such like.

Before I try to build something like this, I'm curious: Has anyone else
already done this?

Thanks very much!

Rob
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The DataReader functions in more or less that manner.
Every time you call Read( ) on the DataReader, it advances one row, like
MoveNext in the old ADO classes, and you can get a value from the current
row just by specifying the name or position as in your example. However,
note that the DataReader is forward-only read-only.

-Rob Teixeira [MVP]

"Rob Richardson" <th*****@n2net.net> wrote in message
news:10*************@corp.supernews.com...
Greetings!

It seems to me that .Net is much more typing-intensive than VB6 was.
Instead of getting a recordset and reading a value from it using something
like "Name = MyRecordset("name")", I have to say something like "Name =
MyDataset.Tables(0).Rows(0)("Name")". I am tempted to write a class that
would inherit from DataSet and would provide the same interface that the VB6 RecordSet object did. It would have to have MoveFirst, MoveNext, EOF, and
BOF methods and such like.

Before I try to build something like this, I'm curious: Has anyone else
already done this?

Thanks very much!

Rob

Nov 20 '05 #2

P: n/a
Rob,
Before I try to build something like this, I'm curious: Has anyone else
already done this? Yep! Microsoft did!

Look up "Typed DataSets" in the online help:

Some links from a quick MSDN search that look promising.

http://msdn.microsoft.com/library/de...etdatasets.asp

http://msdn.microsoft.com/library/de...lstudionet.asp

http://msdn.microsoft.com/library/de...tml/vb03f9.asp

http://msdn.microsoft.com/library/de...peddataset.asp

In case you don't have it, you may want to pick up David Sceppa's book
"Microsoft ADO.NET - Core Reference" from MS Press. It is a good tutorial on
ADO.NET, plus a good desk reference once you know ADO.NET. Also David's book
gives some insight on how the Typed Datasets work...

Hope this helps
Jay

"Rob Richardson" <th*****@n2net.net> wrote in message
news:10*************@corp.supernews.com... Greetings!

It seems to me that .Net is much more typing-intensive than VB6 was.
Instead of getting a recordset and reading a value from it using something
like "Name = MyRecordset("name")", I have to say something like "Name =
MyDataset.Tables(0).Rows(0)("Name")". I am tempted to write a class that
would inherit from DataSet and would provide the same interface that the VB6 RecordSet object did. It would have to have MoveFirst, MoveNext, EOF, and
BOF methods and such like.

Before I try to build something like this, I'm curious: Has anyone else
already done this?

Thanks very much!

Rob

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.