How to make common connection string for diff program?

M

Manish

Hi
i have a problem where as i want to use two different C# net program
in a single system where i have used 2 different sql server name. when
i execute those program each time iam renaming the sql server name and
executing the programs. Is there any way where i can write a
connection string without using a sql server name or is there any
other possibility to solve this problem.
[Note : i don't want to use the same sql serve name for both the
programs.]
 
M

Morten Wennevik [C# MVP]

Hi Manish,

I fail to see your problem. You say you have two different C# applications,
and two different SQL server instances? Why do you need to rewrite anything
to run the programs? Or do you have a single SQL server instance and rename
this instance for each of the applications, with one application using one
instance name and the other application using another?! If the latter is
true why can't you use the same sql server name as the other program?

The connection strings should for each of the programs be put in a Setting
and available in the app/web.config file for the applications. You could
then either just rewrite the connectionstring for either of the applications,
or encrypt the connection string and maybe have the sql server instance name
in a separate setting and dynamically create the connectionstring at runtime.

If this doesn't answer your question, please clarify your problem with added
information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top