473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Determine which machine name "(local)" is?


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
Nov 21 '05 #1
3 1606
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

"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:cu*******************@news.demon.co.uk...

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

Nov 21 '05 #2
Yes, this is great. Presumably "." is the same in any language!

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:e%****************@tk2msftngp13.phx.gbl...
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

"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:cu*******************@news.demon.co.uk...

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


Nov 21 '05 #3
Robin,
As far as I know it is.

Jay
"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:cu*******************@news.demon.co.uk...
Yes, this is great. Presumably "." is the same in any language!

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:e%****************@tk2msftngp13.phx.gbl...
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

"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:cu*******************@news.demon.co.uk...

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



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jack | last post by:
Hi all, Suppose I have a routine to find the maximum of any *univariate* function f in the interval : double f(double x); double findmax(double (*func)(double), double a, double b); Now I...
0
by: Tom Clement | last post by:
Hi folks. I have a question about "Copy Local". We have quite a few projects in our solution (35) and some of them reference the very large "Microsoft.mshtml.dll". I was wondering why leave...
3
by: Doc | last post by:
Hi all, Hoping someone can make me smart. Have SQL Srv2000 database linked (ODBC) for query. Have my completed Query. Want to save out THAT data to a local area for later manipulation (in Access...
3
by: Zeljko | last post by:
Hi, Is there a way to define a local variable that retains it's value between the function calls ? Zeljko
2
by: Kikoz | last post by:
Hi all. I'm using one PC/XP Pro as my development environment. Its IIS has one default web site, of course, which is the site I'm working on. When some feature is finished I deploy it to my...
3
by: Robin Tucker | last post by:
Should I consider this to work in other locales? If theServer.Name <> "(local)" and theServer.Name <> "(localhost)" Then ' Can only use local machine in this version..... End If
2
by: soren625 | last post by:
I have searched this (and other) groups extensively, in addition to the clj FAQ and the Web, and (to my surprise) this question doesn't come up as often as I thought it would. Maybe this is because...
4
by: soren625 | last post by:
What I am trying to do is grab a little snippet of data from a remote page based on user input in a form. Take a look at this page: http://www.qrz.com/kb2gsd What I want to do is: when a user...
2
by: kirk | last post by:
I'd like to programmatically be able to determine if a network interface is currently in "Local Only" or "Local and Internet" access mode. Also I wasn't sure if this is only applicable to Windows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.