Click here to Skip to main content
15,883,623 members
Articles / Programming Languages / C#

Accessing Microsoft Commerce Server Connection Strings

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Sep 2009CPOL3 min read 20.4K   138   4  
A library and sample code to access active connection strings at runtime
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                if (args.Length != 1) {
                    Console.WriteLine("Usage: {0} SITENAME", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
                    return;
                }
                Console.WriteLine("STARTED @ " + DateTime.Now);
                // Dictionary<string, string> conStrs = MSCS_ConStrMngr.ConnectionStringManager.ListConnectionStrings("StarterSite1");
                Dictionary<string, string> conStrs = MSCS_ConStrMngr.ConnectionStringManager.ListDatabaseNames(args[0]);
                foreach (KeyValuePair<string, string> item in conStrs)
                {
                    Console.WriteLine("{0,-30} {1,-30}", item.Key, item.Value);
                }
                Console.WriteLine("ENDED   @ " + DateTime.Now);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Turkey Turkey
As an e-commerce consultant, has been working in IT industry since 2003, has worked on Microsoft Commerce Server, Microsoft CRM, and Microsoft Sharepoint Server.

He is interested in Artificial Intelligence (AI) and Robotics. However doing some research and reading about them are just hobbies, and is not part of his professional life.

As an application of AI in E-Commerce and CRM area he is interested in Business Intelligence concepts such as data mining, and practical implementations of artificial neural networks. He likes to read articles about latest C# development and design patterns.

His spare time activities are cycling and dancing.

Comments and Discussions