471,337 Members | 931 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C# + SQL SMO

I've got one problem:

I wish to use SMO, but the SQL instance is not local, but remote.
I'm giving the IP address in a connection string like that:

Lets use 123.123.123.123 as some stupid example IP

"Server=123.123.123.123,1433;Net=dbmssocn;User ID....";

It works fine, I've got an established connection.

Now I would like to use a SMO, and here is a problem:

Server srv = new Server(...
- what should I put here? Server srv = new Server(123.123.123.123) works
not..
How to handle with that?

I've tried to get computer name by ip, but I also don't know if it's a
good idea (rather not) or at least something is missing here:

IPAddress hostIPAddress = IPAddress.Parse("123.123.123.123");
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
string [] host = hostInfo.HostName.Split('.');
Server srv = new Server(host[0]);
- there is no info about remote ip here, it'll connect with local
instance probably (if local comupter name is host[0]).

Thanks for any suggestion
Dec 10 '05 #1
0 1593

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by

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.