Solved

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

Posted on 2002-04-09
6
228 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 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:job_s
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 learn how to clear a vector as well as how to detect empty vectors in C++.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now