473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Add custom methods to Strong DataSet

Hi all

I have created a strong DataSet using Visual Studio. I have been in to the
DataSet's vb file to have a look at the code and see if I can add things to
it. What I'm after is to create a new method on every DataTable in the
DataSet, this method will be called SelectToTable, as I have the need to
select rows in a current table into another table, and the Select method
only returns an array of data rows. However, any changes that I make are
overwritten the next time I edit and save the DataSet in the designer. Is
there a way to add custom functionality to the DataTables and not have them
overwritten the next time I change something in the designer?

Kind regards,
Steve
Nov 21 '05 #1
3 1237
in a separate file, inherit from the class and extend it -- this will give
you the functionality without having the tool overwrite your source

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> wrote in message
news:ul**************@tk2msftngp13.phx.gbl...
Hi all

I have created a strong DataSet using Visual Studio. I have been in to the
DataSet's vb file to have a look at the code and see if I can add things
to it. What I'm after is to create a new method on every DataTable in the
DataSet, this method will be called SelectToTable, as I have the need to
select rows in a current table into another table, and the Select method
only returns an array of data rows. However, any changes that I make are
overwritten the next time I edit and save the DataSet in the designer. Is
there a way to add custom functionality to the DataTables and not have
them overwritten the next time I change something in the designer?

Kind regards,
Steve

Nov 21 '05 #2
Hiya

Thanks for the suggestion. I now have a Class that inherits the DataSet, but
how do I get the methods on the DataTable objects themselves? Sorry if it's
easy, I haven't done stuff like this before. Currently I have the
SelectToTable method on the DataSet, so it can be called like this:

Dim oDataSet As New MyDataSet
oDataSet.SelectToTable(filterExpression)

Whereas I would like the following:

Dim oDataSet As New MyDataSet
oDataSet.MyTable.SelectToTable(filterExpression)

So the function would return a table of the same type, just with records
that match the filterExpression. I know I could pass through a table or
table name to the DataSet method, but I would prefer it if possible on each
of the DataTables in the DataSet.

Thanks for your continued help!

Steve.
"stand__sure" <st*********@hotmail.com> wrote in message
news:d4**********@domitilla.aioe.org...
in a separate file, inherit from the class and extend it -- this will give
you the functionality without having the tool overwrite your source

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> wrote in message
news:ul**************@tk2msftngp13.phx.gbl...
Hi all

I have created a strong DataSet using Visual Studio. I have been in to
the
DataSet's vb file to have a look at the code and see if I can add things
to it. What I'm after is to create a new method on every DataTable in the
DataSet, this method will be called SelectToTable, as I have the need to
select rows in a current table into another table, and the Select method
only returns an array of data rows. However, any changes that I make are
overwritten the next time I edit and save the DataSet in the designer. Is
there a way to add custom functionality to the DataTables and not have
them overwritten the next time I change something in the designer?

Kind regards,
Steve


Nov 21 '05 #3
On 2005-04-21, Steve Amey <stevea@_RemoveThis_centurion-ms.co.uk> wrote:
Hi all

I have created a strong DataSet using Visual Studio. I have been in to the
DataSet's vb file to have a look at the code and see if I can add things to
it. What I'm after is to create a new method on every DataTable in the
DataSet, this method will be called SelectToTable, as I have the need to
select rows in a current table into another table, and the Select method
only returns an array of data rows. However, any changes that I make are
overwritten the next time I edit and save the DataSet in the designer. Is
there a way to add custom functionality to the DataTables and not have them
overwritten the next time I change something in the designer?


No, there's not. The built-in strongly-typed dataset doesn't provide
the functionality to make this design reasonable, although it would be a
very useful way to do things. it's simple enough to inherit from the
dataset, but as you've found, much more difficult to create a usable
subclass of DataTables or typed rows or such.

There's a bunch of alternatives to the standard DataSet out there that
can do this kind of thing. AGDataSetGenerator is one of the more
popular addins that do this (google for it).
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: localhost | last post by:
I have a static, thread-safe class with a DataSet as a property. When the class is instanced into an object, some callers add rows to a DataTable in the DataSet. Other callers read the DataSet. ...
1
by: George | last post by:
I am wondering what is the cost of using DataTable. Lets say i have 1000 Employee records. The object oriented purist will require the Data Layer to return an ArrayList with 1000 Employee objects....
1
by: Josue Avila M. | last post by:
HI I Design a Class Wich contains severals DataTypes . (2 Strings and Other Data Types from a Class wich i Desing to) Its Something like This <serializable()> Public Class Emitor Public...
3
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
5
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
4
by: Usarian | last post by:
I am making some custom objects that operate "inside" each other, the way a datatable is available inside a dataset. (VB.NET 1.1) I can't figure out how to make the child object know what object...
0
by: Atul Thombre | last post by:
Hello, I am developing a custom membership provider. For that I built a prototype that uses a SQL Server 2005 database as a backend store. I implemented the class...
3
by: =?Utf-8?B?R2hpc3Rvcw==?= | last post by:
Hi all, We have a N-Tier framework and we now create a Web Site App to wotk with this architecture. I add reference from my libraries in the project and creating page and controls is very...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.