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

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 3459

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Uwe Mayer | last post by:
Hi, I want to create a copy of an object from out of its base class: class A(object): def copy(self): .... class B(A): ....
7
by: Lowell Kirsh | last post by:
I want to create a class called DefaultAttr which returns a default value for all attributes which haven't been given values yet. It will work like this: >> x = DefaultAttr(99) >> print x.foo...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
18
by: Steven Bethard | last post by:
I've updated the PEP based on a number of comments on comp.lang.python. The most updated versions are still at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
18
by: Sandra-24 | last post by:
Can you create an instance of a subclass using an existing instance of the base class? Such things would be impossible in some languages or very difficult in others. I wonder if this can be done...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
1
by: sebascomeau | last post by:
Hi, I don't know if this is possible but a just want to know if it is. I want to create a new object on the fly from another object with the same properties but all properties was another type...
4
by: Robert | last post by:
Greetings New to Visual Studio 2008. Always us VB6.0 SP5. I am trying to copy files from A to B. I select a directory, and copy files. Works ok, but it does not create the directory first. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.