Determine which machine name "(local)" is?

  • Thread starter Thread starter Robin Tucker
  • Start date Start date
R

Robin Tucker

I'm fetching a list of SQL servers on a domain using a function that returns
strings, including "(local)" for the local machine (if it has an SQL server
on it). Now, presumably in a different locale, the word "(local)" will be
something else. I cannot thus compare the string to see if its "(local)"
and replace it with Environment.MachineName. So I need a way of determining
if a given string is the local machine.

ie.:

Dim theString as ConnectionName = GetServerName() ' may return "(local)"

Dim bIsLocal as boolean = somefunc.IsLocal ( theString )

Any ideas?


Thanks



Robin
 
Robin,
You can use "." to mean local also.

Alternatively you can use Environment.MachineName to get the name of the
machine you are on.

For SQL Server I think I would favor "." over Environment.MachineName,
especially in "hard coded" connection strings, as I can use "." at compile
time & not worry about building the string later...

Hope this helps
Jay
 

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

Back
Top