PC Review


Reply
Thread Tools Rate Thread

Create copy of the object

 
 
Jul
Guest
Posts: n/a
 
      18th Oct 2004
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


 
Reply With Quote
 
 
 
 
David Browne
Guest
Posts: n/a
 
      19th Oct 2004

"Jul" <(E-Mail Removed)> wrote in message
news:GMXcd.18777$(E-Mail Removed)...
> 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


 
Reply With Quote
 
Jul
Guest
Posts: n/a
 
      19th Oct 2004

"David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> "Jul" <(E-Mail Removed)> wrote in message
> news:GMXcd.18777$(E-Mail Removed)...
> > 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
>
>



 
Reply With Quote
 
Gerald Hernandez
Guest
Posts: n/a
 
      19th Oct 2004
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" <(E-Mail Removed)> wrote in message
newsrYcd.19277$(E-Mail Removed)...
>
> "David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
> >
> > "Jul" <(E-Mail Removed)> wrote in message
> > news:GMXcd.18777$(E-Mail Removed)...
> > > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy object or export object, can't open object laavista Microsoft Access 5 28th Jun 2009 04:50 AM
Best practice, copy object, using a shadow Object for a undo functionality Tomas Microsoft VB .NET 2 8th Nov 2006 04:20 PM
Referenced object versus copy of object OpticTygre Microsoft VB .NET 4 18th Mar 2006 02:17 PM
create a new graphicex object from a empty bitmapex object Alien Microsoft Dot NET Compact Framework 0 10th Sep 2005 12:11 PM
Re: How can I create object in runtime with Type object? Josue Camargo Cruz Microsoft Dot NET 0 7th Nov 2004 08:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 AM.