Click here to Skip to main content
15,911,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

how to find List of oracle Servers Available in a network through c#

thanks in advance
Posted

1 solution

System.Environment of mscorlib assembly helps you to fetch the server list as:

C#
using System.Environment;

string myServer = Environment.MachineName;

DataTable servers = SqlDataSourceEnumerator.Instance.GetDataSources();
for (int i = 0; i < servers.Rows.Count; i++)
{
  if (myServer == servers.RowsIdea["ServerName"].ToString()) ///// used to get the servers in the local machine////
  {
    if ((servers.RowsIdea["InstanceName"] as string) != null)
       CmbServerName.Items.Add(servers.RowsIdea["ServerName"] + "\\" + servers.RowsIdea["InstanceName"]);
    else
       CmbServerName.Items.Add(servers.RowsIdea["ServerName"]);
  }
 }
 
Share this answer
 
Comments
K N R 21-Nov-11 23:46pm    
how to filter oracle and sql servers

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900