What ought to be the C# code to locate all of the Database Servers connected inside a network(including instance-title, port no, and Ip)?

Do you use it for just about any RDBMS Server?

The way to go is definitely likely to be "no" here. Every RDBMS allows you place up a custom port - MySQL might be on 1433 or 1434 or 99999. Every RDBMS responds in a different way using their company RDBMSes as well as sometimes from previous versions of itself... You'd need to check every networking port possible on every computer for each RDBMS (and each version of this RDBMS when they change response strings frequently) and HOPE they've them set up with standard plaintext reactions rather than being encoded or whatnot. This really is fundamental networking - firstly you portscan the IP range, you'll be able to attempt to appscan around the active ports you've found to determine the way they react to various demands, then you definitely use that information to express "these Insolvency practitioners have applications that seem to be databases around the following ports" -- you are still not getting such things as MS Instance Title without studying the proper channels (as listed with code samples above).

Your best choice for understanding how to start is most likely - http://www.nmap.org

To mix things stated in the earlier solutions / comments:

Speak to your sysadmin, becasue this really is undoable. You should take into account every version of each and every (R)DBMS available (or at best the most recent ones).

Assets: http://msdn.microsoft.com/en-us/library/ms162169.aspx http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en

You would like to consider SMO. This involves each client to achieve the Sql Management Objects and CLR types installed. Below is really a code snippet in one of my working programs that does this.

private void OnClicked_RefreshDataSources(object sender, EventArgs e) {
        Cursor = Cursors.WaitCursor;

        DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
        uxDataSource.Items.Clear();

        foreach (DataRow row in dt.Rows) {
            uxDataSource.Items.Add(row["Name"]);
        }

        if (dt.Rows.Count > 0) {
            uxDataSource.SelectedIndex = 0;
        }

        Cursor = Cursors.Default;
    }

    private void OnSelectedIndexChanged_PopulateDatabases(object sender, EventArgs e) {
        ConnectionString.DataSource = uxDataSource.SelectedItem.ToString();

        Server server = new Server(uxDataSource.SelectedItem.ToString());
        server.ConnectionContext.LoginSecure = false;
        server.ConnectionContext.Login = Program.DesktopService.AccountName;

        uxInitialCatalog.Items.Clear();

        try {
            foreach (Database db in server.Databases) {
                uxInitialCatalog.Items.Add(db.Name);
            }

            if (server.Databases.Count > 0) {
                uxInitialCatalog.SelectedIndex = 0;
            }
        }
        catch {
            MessageBox.Show("You do not have access to this server.", "Sql Connection", MessageBoxButtons.OK, 
                MessageBoxIcon.Warning);
            uxInitialCatalog.Items.Clear();
        }
    }

You could utilize the SqlDataSourceEnumerator class with this too. Bear in mind, this really is MS SQL Server specific...

var results = SqlDataSourceEnumerator.Instance.GetDataSources();

foreach (var row in results.Rows)
{
    Console.WriteLine("{0}\{1}", row["ServerName"], row["InstanceName"]);
}

Check this out link for further info