468,761 Members | 1,773 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,761 developers. It's quick & easy.

Create copy of the object

Jul
Hi,

I need to create copy (clone) the OracleConnection object.
The OracleConnection class does not contain "Clone" method for creating
copy.
It contains Protected MemberwiseClone

but if use this method:
conDB = CType(conValue.MemberwiseClone(), OracleConnection)

(it is an example from help)

the VS returns error: method is not accessible in this contest because it
is 'Protected'

How this method can be used or any another way to copy object?

Thanks
Nov 21 '05 #1
3 3272

"Jul" <ju********@sympatico.ca> wrote in message
news:GM********************@news20.bellglobal.com. ..
Hi,

I need to create copy (clone) the OracleConnection object.
I doubt that.
The OracleConnection class does not contain "Clone" method for creating
copy.
It contains Protected MemberwiseClone

but if use this method:
conDB = CType(conValue.MemberwiseClone(), OracleConnection)

(it is an example from help)

the VS returns error: method is not accessible in this contest because it
is 'Protected'

How this method can be used or any another way to copy object?


You can't copy an OracleConnection since it wraps an OCI session. You can
always create another OracleConnection with the same connection string.

David
Nov 21 '05 #2
Jul

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:ux**************@tk2msftngp13.phx.gbl...

"Jul" <ju********@sympatico.ca> wrote in message
news:GM********************@news20.bellglobal.com. ..
Hi,

I need to create copy (clone) the OracleConnection object.
I doubt that.


Why? The called module is DLL, sure it can open another connection but why
not use the previous one?
Anyway , you already answered that I can not create a copy, thanks.

Maybe you also know the answer to my second question - I posted it with
subject "Declare as Public at different modules"
The OracleConnection class does not contain "Clone" method for creating
copy.
It contains Protected MemberwiseClone

but if use this method:
conDB = CType(conValue.MemberwiseClone(), OracleConnection)

(it is an example from help)

the VS returns error: method is not accessible in this contest because it is 'Protected'

How this method can be used or any another way to copy object?


You can't copy an OracleConnection since it wraps an OCI session. You can
always create another OracleConnection with the same connection string.

David

Nov 21 '05 #3
Do you want another reference to the same connection object?
Then just create another variable type of OracleConnection and assign it to
an existing one.
Note however they are the same object instance, not a new connection.
If you close, etc., one, you close them both.

If you want another one with the same parameters, then you need to create a
new one. You could copy the appropriate parameters such as connection string
and such from the original. These would then be 2 seperate connections.

Gerald

"Jul" <ju********@sympatico.ca> wrote in message
news:pr********************@news20.bellglobal.com. ..

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:ux**************@tk2msftngp13.phx.gbl...

"Jul" <ju********@sympatico.ca> wrote in message
news:GM********************@news20.bellglobal.com. ..
Hi,

I need to create copy (clone) the OracleConnection object.


I doubt that.


Why? The called module is DLL, sure it can open another connection but why
not use the previous one?
Anyway , you already answered that I can not create a copy, thanks.

Maybe you also know the answer to my second question - I posted it with
subject "Declare as Public at different modules"
The OracleConnection class does not contain "Clone" method for creating copy.
It contains Protected MemberwiseClone

but if use this method:
conDB = CType(conValue.MemberwiseClone(), OracleConnection)

(it is an example from help)

the VS returns error: method is not accessible in this contest because it is 'Protected'

How this method can be used or any another way to copy object?


You can't copy an OracleConnection since it wraps an OCI session. You can always create another OracleConnection with the same connection string.

David


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Uwe Mayer | last post: by
7 posts views Thread by Lowell Kirsh | last post: by
18 posts views Thread by Steven Bethard | last post: by
4 posts views Thread by Robert | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.