Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to duplicate another instance of COM in the same server?

Posted on 2002-04-09
6
Medium Priority
?
239 Views
Last Modified: 2011-09-20
I have a com dll used in a website.
It is used to communicate with the database.
It stores the connection string...etc

now I need to reuse this com dll in another website to connect to another database.
the website is in the same server.

I make another copy of the source code and change the sql connection string. when I try to register the dll in component services, it return "The object is already registered"

How do I duplicate another copy of the dll? The com class name must remain the same otherwise I have to recode the asp files that calls this com.
0
Comment
Question by:stl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Accepted Solution

by:
pkreddy earned 600 total points
ID: 6930811
Probably you can try this...
 Make a copy of the source code, change its CLSID & Prog-id. You can generate new CLSID using 'guidgen.exe' and replace the old CLSID. Make necessary changes required by you and recompile and use it with new Prog-id & CLSID.
0
 
LVL 3

Expert Comment

by:job_s
ID: 6931087
I think U can use the same component.
U can add functions for setting
Database , Password and UserName to the interface.
So after creating the com through ASP U can call set function with required Database before calling other functions .

Simply U can avoid the code duplication. If the code are same.

If I misunderstood Ur comment sorry for that.


job_s



0
 

Author Comment

by:stl
ID: 6932887
pkreddy,
I have tried changin CLSID before, it will not work.
May be changing prog-id will work but does that mean that I have to change all my asp code that creates the object?

job_s,
this means that I have to change all existing asp code.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:job_s
ID: 6933346
I don't think much change needed on asp.

add one function with three parameters

HRESLUT Setparams( BSTR Database , BSTR Password , BSTR UserName);

Need to call one additional  function for
setting Database , Password and UserName to the interface

Object.SetParams( DatabseName, DBUserName, DBPassword )

I think better to try this.
0
 
LVL 22

Expert Comment

by:ambience
ID: 6941184
If your component uses COM+, its better to support Consrtuctor String by implementing a single interface ICOnstructString. This lets your component be administered thru the management console and you can later change the Connection string without needing to change even a single line of code.

For other platforms or reasons, and as mentioned above you can pass the Connection String from the ASP pages. This way again your component will not need be re-written or duplicated.

I guess this is far better than duplicating and managing two different components that differ only in the way they connect to the database.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7012017
Dear stl

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "job_s"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question