473,769 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to inherit from sqlconnection

I would like to create a component that inherits from sqlconnection, but it
is sealed. What ancestor can I inherit from?

I've seen this:

public sealed class SqlConnection : Component, IDbConnection,
ICloneable

So, I've tried:

public class MyConnection : Component, System.Data.IDb Connection, ICloneable

But I obtain a lot of errors saying:

'MyConnection.M yConnection' does not implement interface member
'System.Data.ID bConnection.xxx xxxxxxxxxxx()'

What can I do?

Nov 17 '05 #1
2 7796
What can you do? You can learn the language before trying to code
IDbConnection is an interface
http://www.google.com/search?hl=en&l...%23+interfaces
Happy learning

"Carlos" <a@mapola.com > wrote in message
news:O4******** ******@TK2MSFTN GP09.phx.gbl...
I would like to create a component that inherits from sqlconnection, but it is sealed. What ancestor can I inherit from?

I've seen this:

public sealed class SqlConnection : Component, IDbConnection,
ICloneable

So, I've tried:

public class MyConnection : Component, System.Data.IDb Connection, ICloneable
But I obtain a lot of errors saying:

'MyConnection.M yConnection' does not implement interface member
'System.Data.ID bConnection.xxx xxxxxxxxxxx()'

What can I do?


Nov 17 '05 #2
General note:

Don't inherit, use composition instead

class MyComponent
{
private SqlConnection connection;
....
public void Open()
{
connection.Open ();
}

public ConnectionState State
{
get {return connection.Stat e;}
set {connection.Sta te = value;}
}
//and so on
}

"Lebesgue" <no****@spam.jp > wrote in message
news:u9******** *****@TK2MSFTNG P12.phx.gbl...
What can you do? You can learn the language before trying to code
IDbConnection is an interface
http://www.google.com/search?hl=en&l...%23+interfaces
Happy learning

"Carlos" <a@mapola.com > wrote in message
news:O4******** ******@TK2MSFTN GP09.phx.gbl...
I would like to create a component that inherits from sqlconnection, but

it
is sealed. What ancestor can I inherit from?

I've seen this:

public sealed class SqlConnection : Component, IDbConnection,
ICloneable

So, I've tried:

public class MyConnection : Component, System.Data.IDb Connection,

ICloneable

But I obtain a lot of errors saying:

'MyConnection.M yConnection' does not implement interface member
'System.Data.ID bConnection.xxx xxxxxxxxxxx()'

What can I do?



Nov 17 '05 #3

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

Similar topics

7
19488
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
1
558
by: Donnie Darko | last post by:
I'm trying to understand SqlConnection(), SqlCommand() For example. I use SqlConnection() as a parameter when I create a new SqlCommand. Then I open SqlConnection(), then I execute the SqlCommand(). At that point I cannot use SqlConnection() again. Unless I .Close() it and then .Open it right? Then what is 'connection pooling' ? Can't I run multiple SqlCommand()s on the same SqlConnection() somehow ?
5
5412
by: Mike | last post by:
I need to expand the DataSet class by inheriting from it and adding functions that work on the data in the tables. However, since I can't upcast how can I get my base DataSet object assigned an actual DataSet? e.g. public class MyDataSet : DataSet { // can't do, no valid DataSet constructor
4
5183
by: The Coolest Dolphin | last post by:
Hi all, I have a question/problem concerning usage of my sqlconnection throughout my program. In my main form (frmMain) I defined an sqlconnection (I've set the connection public so that I can open & close the connection from everywhere in my app). My main form is an mdi parent which contains several mdi-childs. To open and close the sqlconnection in an mdi-child i use the following:
17
9392
by: LP | last post by:
Hello, Here's the scenario: Object A opens a Sql Db connection to execute number of SqlCommands. Then it needs to pass this connection to a constructor of object B which in turn executes more commands on the same connection. I have an understanding that if SqlConnection is passed as "value" (unboxed), object B will create its own copy of SqlConnection, so when object A closes its connection, it remains open for object B's copy. Is this
4
2057
by: Steve Richter | last post by:
I really miss c++ .... I have an SqlConnection object within my Web.UI.Page object. The thinking is that the connection to the database server is opened once when the page starts to do its thing, then when everything is rendered down to the browser, and all references to the page object are ended, the connection to the server can be closed. First of all, are the SqlConnection Open and Close methods quick performers and I dont need to...
9
4199
by: Roman | last post by:
Hello I have a component built in VB.2003. It has the following property: Public Shared mCONN As SqlConnection Public Property Connection() As SqlConnection Get Return mCONN End Get Set(ByVal value As SqlConnection)
4
3894
by: Victor | last post by:
Hi Guys I have a problem here. I want to improve the performance for a website. When I looked into the system, I have found that the system made the "SqlConnection Object" static. That mean only one SqlConnection object will be used. Can someone tell me is that a correct way to do? Does that affect the system performance? Cheers Victor
2
3900
by: GTalbot | last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues, Imagine this situation: #grand-parent-abs-pos { height: 400px; position: absolute; width: 600px; }
0
9423
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,...
0
10211
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
10045
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
9994
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
9863
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
7408
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
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
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.