473,671 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1249
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@_Remove This_centurion-ms.co.uk> wrote in message
news:ul******** ******@tk2msftn gp13.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.Select ToTable(filterE xpression)

Whereas I would like the following:

Dim oDataSet As New MyDataSet
oDataSet.MyTabl e.SelectToTable (filterExpressi on)

So the function would return a table of the same type, just with records
that match the filterExpressio n. 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__sur e" <st*********@ho tmail.com> wrote in message
news:d4******** **@domitilla.ai oe.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@_Remove This_centurion-ms.co.uk> wrote in message
news:ul******** ******@tk2msftn gp13.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@_Remove This_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. AGDataSetGenera tor 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
1521
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. When any caller reads the DataSet, I want the object to delete all of the rows in the DataTable. I think I want to make a custom event but I don't know where/how to get started. Help? Thanks.
1
1855
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. But very often we (at least i) returning DataTable to populate the grid. But now i am wondering: Am i gaining anything? The DataTable has to create object DataRow for each row. Versus i am creating Employee object for each row. So unless...
1
1979
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 NameMsg as String Public KeyCode as String Public Parmas as DAtaParams
3
2751
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 typed properties from my original dataset Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated Thank, Freeon
5
6908
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
3
1860
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 yesterday. Because of this I try to limit my calls to the database by using a loading lookup data for a customer and then filtering down to what I need. (I have alot of recursive logic because of alot of tree controls). Here is my question. ...
4
1562
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 it's inside of. What I have is a custom object called Ageload which contains a custom collection designed to hold another custom object called a Batch. (Ageload, BatchCollection, Batch) When I use a dataset with a table in it, I can do...
0
2114
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 System.Web.Security.MembershipProvider and implemented few necessary methods. The methods use SQL for interacting with the SQL Server database. I put all this code in a class library. I also created a simple Website using Visual Studio 2005 and configured the Web.config to...
3
1925
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 easy, using my objects. But, it's seem that I cannot create report using Crystal Report with my objects. I created classes in the app_Code folder and yes, I can use them but, it's not the way I eant to do it. I want to use my classes from my dlls.
0
8473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8911
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.