Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-04-09
6
Medium Priority
?
241 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
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
Independent Software Vendors: 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

916 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