473,793 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1522
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.c om> wrote in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
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.mach in AT dot.state.fl.us > wrote
in message news:Ou******** ******@TK2MSFTN GP02.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.c om> wrote in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
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:

IDataParameterC ollection Parameters
{
get
{
return m_sqlCommand.Pa rameters
}
}

Apr 28 '06 #4

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

Similar topics

5
5056
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 form record. In each page of the tab control, there are three buttons: Add, Update, Delete. Any of these buttons will open another, smaller form to add, update or delete the related data record. Originally, I had placed the smaller form such...
5
2756
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. I am trying to add a feature whereby the control changes to a different color when the mouse floats over it, or when the button has the focus. The color changing works if the 'LightColor' is set at runtime in code. However, if I draw the control on...
5
4642
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 imagebutton control) I would like to change the name of the BorderColor property to InnerBorderColor because it would make more sense in the context of this this new control. Thanks Earl
2
1358
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 "onLoad" and "onClick") by calling the javascript method <object>.disabled = <true/false>. This works visably fine on the webpage, however, when I do a postback to the server and check the <WebControl>.Enabled property on an item I disabled via the...
1
1691
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 by their underlying classes (such as the TextBox control), and are not persisted by me. 2.) Unique Properties that don't map directly and are persisted in ViewState (ex.: this.LabelPosition, which specifies where on the form the label should be...
11
2242
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 string "d" then I want to emable rblDebts which is disabled when the page loads. This part is not working (no errors) and I'm not sure why. Thanks. <script type="text/javascript" language="JavaScript"> <!-- Begin oldvalue = "";
1
1433
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
2866
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 when it appears on the task bar? I don't want the context menu showing up when a user right clicks on it. I don't want the user to be able to do anything with it other than stare at it in its minimized form. I know we can P/Invoke into some...
6
621
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? "Nathan Sokalski" <njsokalski@hotmail.comwrote in message news:er%23hyAFOJHA.1896@TK2MSFTNGP02.phx.gbl...
0
9670
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
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10159
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
10000
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
7538
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
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
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.