Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:13:06+00:00 2026-06-11T15:13:06+00:00

string rawConnString = Properties.Settings.Default.ConnectionString; I want to do this with rawConnString: rawConnString.Replace(<<DATA_SOURCE>>, server); rawConnString.Replace(<<INITIAL_CATALOG>>,

  • 0
string rawConnString = Properties.Settings.Default.ConnectionString;

I want to do this with “rawConnString”:

rawConnString.Replace("<<DATA_SOURCE>>", server);
rawConnString.Replace("<<INITIAL_CATALOG>>", "tempdb");

Then set the final string to variable finalConnString.

How would I go about doing this?

This is ASP .NET 4.0/C# btw.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:13:07+00:00Added an answer on June 11, 2026 at 3:13 pm
    string finalString = Properties.Settings.Default.ConnectionString.Replace("<<DATA_SOURCE>>", server).Replace("<<INITIAL_CATALOG>>", "tempdb"); 
    

    will do it all in one line of code. But it’s uglier IMO because you’ll have to scroll. The code in your question seems a LOT cleaner and more readable to me.

    And doing it in one line of code won’t help your performance at all. It should all compile down to the same MSIL either way. I’d leave it as you had it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

String str = abcde123_92qwq_1a_02x_1e; I want to replace the first string part between the
String data=this we want append in that file; byte[] getbyte = data.getBytes(); outputstream.write(getbyte); outputstream.flush();
string one = find; combobox1.text = one; I want to use one i.e string
string abc = This is a string; How do I load abc into a
string tags = 9,3,12,43,2 List<int> TagIds = tags.Split(','); This doesn't work cause the split
string.lastIndexOf(searchValue[, fromIndex]) MDN says that fromIndex default value is equal to the string.length ,
string []URL = {www.facebook.com,www.orkut.com,www.yahoo.com}; Int32 result = URL.Length; SetPolicyURL( URL,result ); this is my
String s1 = Project; String s2 = Sunject; I want to compare the two
string [] files = new string[2]; files[0] = ThinkFarAhead.Example.Settings.Configuration_Local.xml; files[1] = ThinkFarAhead.Example.Settings.Configuration_Global.xml; //Resharper complains
String comes back from the database with a format: '00/00/0000' I need to then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.