473,396 Members | 1,866 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,396 software developers and data experts.

Disabling certain routines/properties when inheriting.....

UJ
I am going to write a class that will inherit from SqlCommand and I want to
disable certain routines in the SqlCommand and add a couple of new routines.
How would I go about doing that? I understand (I think) the inheritance
process but I'm worried more about the disabling of the routines. I want to
disable certain routines and add my own to do some special things.

Thanks for the help.

Jeff.
Apr 28 '06 #1
3 1495
Hi,

Can you give a concrete example?

You can redefine the virtual methods, maybe throwning exception if you dim
it as unnecesary.
"UJ" <fr**@nowhere.com> wrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
I am going to write a class that will inherit from SqlCommand and I want to
disable certain routines in the SqlCommand and add a couple of new
routines. How would I go about doing that? I understand (I think) the
inheritance process but I'm worried more about the disabling of the
routines. I want to disable certain routines and add my own to do some
special things.

Thanks for the help.

Jeff.

Apr 28 '06 #2
UJ
I want to take SQLCommand and remove ExecuteNonQuery (among others) and
implement my own routine that will do error checking and connection
organization. If I have to I can override the routine but I'd like to remove
it completely so people don't use it by accident.

I'd like to inherit from SQLCommand for all of the things like parameters,
command type, ....

TIA - Jeff

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:Ou**************@TK2MSFTNGP02.phx.gbl...
Hi,

Can you give a concrete example?

You can redefine the virtual methods, maybe throwning exception if you dim
it as unnecesary.
"UJ" <fr**@nowhere.com> wrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
I am going to write a class that will inherit from SqlCommand and I want
to disable certain routines in the SqlCommand and add a couple of new
routines. How would I go about doing that? I understand (I think) the
inheritance process but I'm worried more about the disabling of the
routines. I want to disable certain routines and add my own to do some
special things.

Thanks for the help.

Jeff.


Apr 28 '06 #3
Well, your first problem is that SqlCommand is a sealed class which
cannot be inherited from.

It only has about 20 methods/properties and you've already said that
you want to hide some of them. Best just to contain a SqlCommand and
redirect the properites you want to keep:

IDataParameterCollection Parameters
{
get
{
return m_sqlCommand.Parameters
}
}

Apr 28 '06 #4

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

Similar topics

5
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main...
5
by: Guy | last post by:
Guys Hope someone can help me! I'm having real problems getting properties I type against a control I have written at design time I have written a control by inheriting from the Button control....
5
by: Earl Teigrob | last post by:
Is there a way to rename the public properties of a inherited class? I am inheriting an asp.net control (class) and am adding addtional functionality. (in this case, up to 3 borders on an...
2
by: Harry | last post by:
Hello, I have an ASP.Net web page populated with WebControls, such as textboxes and checkboxes. On this page I also have a JavaScript that disables these textboxes under certain events (such as...
1
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled...
11
by: shankwheat | last post by:
I have a function which passes text from txtdebt to debtsbox which works fine. However, I want to add code which examines the value of debtsbox and if any of the values the user entered contain the...
1
by: Garg | last post by:
Hi i want to disable soem months in my calendar control. I dont want to display certain months at all in my calendar. How do i do that? Shivani
5
by: Dilip | last post by:
I have written a C# based console application. Due to some issues thats been causing me endless nightmares, I was wondering, is there a way to prevent right mousebutton clicks on my application...
6
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.