473,779 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect to database

This is kind of a cross forum problem. I am trying to Connect to database by
clicking on: Tools Connect To Database Select: Microsoft SQL Server
(SqlClient). However, there are no server listed when I click on Refresh. I
know that 2 instances exist. I see them Management Studio. I think this is
preventing the listing of local instances using SMO.
--
L. A. Jones
Nov 25 '07 #1
4 2387
Dave,

If you type the name of the server, does the connection dialog exist?

You say you see them in management studio, but if I recall correctly,
the drop down on the connection dialog for management studio is a MRU (most
recently used) list, not the list of available machines. You have to select
the last item ("browse") to get a list of available servers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Dave" <Da**@discussio ns.microsoft.co mwrote in message
news:B0******** *************** ***********@mic rosoft.com...
This is kind of a cross forum problem. I am trying to Connect to database
by
clicking on: Tools Connect To Database Select: Microsoft SQL Server
(SqlClient). However, there are no server listed when I click on Refresh.
I
know that 2 instances exist. I see them Management Studio. I think this is
preventing the listing of local instances using SMO.
--
L. A. Jones
Nov 25 '07 #2
I can connect to the the server. I have attached the database to my server
using Management Studio. When I try to connect to the database I get error:
"Cannot connect to default database. Login failed . Login failed for user
'myservername/hp_owner' ". However, if it is not attached I will not an error.
--
L. A. Jones
"Nicholas Paldino [.NET/C# MVP]" wrote:
Dave,

If you type the name of the server, does the connection dialog exist?

You say you see them in management studio, but if I recall correctly,
the drop down on the connection dialog for management studio is a MRU (most
recently used) list, not the list of available machines. You have to select
the last item ("browse") to get a list of available servers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Dave" <Da**@discussio ns.microsoft.co mwrote in message
news:B0******** *************** ***********@mic rosoft.com...
This is kind of a cross forum problem. I am trying to Connect to database
by
clicking on: Tools Connect To Database Select: Microsoft SQL Server
(SqlClient). However, there are no server listed when I click on Refresh.
I
know that 2 instances exist. I see them Management Studio. I think this is
preventing the listing of local instances using SMO.
--
L. A. Jones
Nov 25 '07 #3
Why does the following code do not show any servers? Previously it behaved
erratic, that is, sometimes you servers sometimes you don't. Now I am getting
no servers. I know that there are some issues with SMO. But what I don't
understand is why I have a complete blackout of available servers.

try
{

// Get a list of SQL servers available on the networks
DataTable dtSQLServers =

SmoApplication. EnumAvailableSq lServers(false) ;

foreach (DataRow drServer in dtSQLServers.Ro ws)
{
String ServerName;
ServerName = drServer["Server"].ToString();

if (drServer["Instance"] != null &&

drServer["Instance"].ToString().Len gth 0)
ServerName += @"\" + drServer["Instance"].ToString();

if (cmbServer.Item s.IndexOf(Serve rName) < 0)
cmbServer.Items .Add(ServerName );
}

// By default select the local server
Server LocalServer = new Server();

String LocalServerName = LocalServer.Nam e;
if (LocalServer.In stanceName != null &&

LocalServer.Ins tanceName.Lengt h 0)
LocalServerName += @"\" + LocalServer.Ins tanceName;

Int32 ItemIndex = cmbServer.FindS tringExact(Loca lServerName);

if (ItemIndex >= 0)
{
this.cmbDatabas e.Sorted = true;
cmbServer.Selec tedIndex = ItemIndex;
llblConnect.Ena bled = true;
}
else
{
this.cmbServer. Text = "<No available SQL Servers>";
llblConnect.Ena bled = false;
}

}
catch (SmoException smoException)
{
MessageBox.Show (smoException.M essage);
}
catch (Exception exception)
{
MessageBox.Show (exception.Mess age);
}
--
L. A. Jones
"Nicholas Paldino [.NET/C# MVP]" wrote:
Dave,

If you type the name of the server, does the connection dialog exist?

You say you see them in management studio, but if I recall correctly,
the drop down on the connection dialog for management studio is a MRU (most
recently used) list, not the list of available machines. You have to select
the last item ("browse") to get a list of available servers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Dave" <Da**@discussio ns.microsoft.co mwrote in message
news:B0******** *************** ***********@mic rosoft.com...
This is kind of a cross forum problem. I am trying to Connect to database
by
clicking on: Tools Connect To Database Select: Microsoft SQL Server
(SqlClient). However, there are no server listed when I click on Refresh.
I
know that 2 instances exist. I see them Management Studio. I think this is
preventing the listing of local instances using SMO.
--
L. A. Jones
Nov 25 '07 #4
Liz

"Dave" <Da**@discussio ns.microsoft.co mwrote in message
news:1B******** *************** ***********@mic rosoft.com...
Why does the following code do not show any servers? Previously it behaved
erratic, that is, sometimes you servers sometimes you don't. Now I am
getting
no servers. I know that there are some issues with SMO. But what I don't
understand is why I have a complete blackout of available servers.
what *exactly* is the "Instance" column supposed to show? I can enumerate
my 3 SQL Servers and display the column "Name" returned by
EnumAvailableSq lServers but the column "Instance" displays nothing at all
....
try
{

// Get a list of SQL servers available on the networks
DataTable dtSQLServers =

SmoApplication. EnumAvailableSq lServers(false) ;

foreach (DataRow drServer in dtSQLServers.Ro ws)
{
String ServerName;
ServerName = drServer["Server"].ToString();

if (drServer["Instance"] != null &&

drServer["Instance"].ToString().Len gth 0)
ServerName += @"\" +
drServer["Instance"].ToString();

if (cmbServer.Item s.IndexOf(Serve rName) < 0)
cmbServer.Items .Add(ServerName );
}

// By default select the local server
Server LocalServer = new Server();

String LocalServerName = LocalServer.Nam e;
if (LocalServer.In stanceName != null &&

LocalServer.Ins tanceName.Lengt h 0)
LocalServerName += @"\" + LocalServer.Ins tanceName;

Int32 ItemIndex =
cmbServer.FindS tringExact(Loca lServerName);

if (ItemIndex >= 0)
{
this.cmbDatabas e.Sorted = true;
cmbServer.Selec tedIndex = ItemIndex;
llblConnect.Ena bled = true;
}
else
{
this.cmbServer. Text = "<No available SQL Servers>";
llblConnect.Ena bled = false;
}

}
catch (SmoException smoException)
{
MessageBox.Show (smoException.M essage);
}
catch (Exception exception)
{
MessageBox.Show (exception.Mess age);
}
--
L. A. Jones
"Nicholas Paldino [.NET/C# MVP]" wrote:
>Dave,

If you type the name of the server, does the connection dialog exist?

You say you see them in management studio, but if I recall correctly,
the drop down on the connection dialog for management studio is a MRU
(most
recently used) list, not the list of available machines. You have to
select
the last item ("browse") to get a list of available servers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Dave" <Da**@discussio ns.microsoft.co mwrote in message
news:B0******* *************** ************@mi crosoft.com...
This is kind of a cross forum problem. I am trying to Connect to
database
by
clicking on: Tools Connect To Database Select: Microsoft SQL Server
(SqlClient). However, there are no server listed when I click on
Refresh.
I
know that 2 instances exist. I see them Management Studio. I think this
is
preventing the listing of local instances using SMO.
--
L. A. Jones

Nov 25 '07 #5

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

Similar topics

20
4824
by: Mr Dygi | last post by:
Hi, PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a problem with this simple code: <?php $link = mysql_connect("127.0.0.1","","") or die("Could not connect: " . mysql_error()); echo "Connected successfully"; mysql_close($link);
1
4814
by: DAVID | last post by:
Hello, With regards to the Connect dialog on Oracle forms 6i via which we can connect to Oracle database, should we use the same functionality on forms run time again? I mean, I want to make a window with three screen items for username, password and service name. And on run time after connecting to the database I use this window to reconnect to an other database. So when I give the appropriate information, I will connect to the
3
6068
by: Lee | last post by:
Hi, I'm developing a socket program to connect to Informix database through the ODBC. In here i called my socket program as "tap" . My tap will listen for data from unix through port 1070. After checking of the data, tap will then insert the data to the informix database. I know we can point the tap to one specified port in Informix database through the services file. My question is how should i know to which port my tap program send out...
4
5606
by: Scott Holland | last post by:
HELP - Need to connect to DB2 database on AIX from NT server. Also AS/400 from NT Server -- I am experienced in ORACLE and a novice at DB2. What tools would be the equivalent of Net*8 or SQLNET in ORACLE that would allow me to connect to a database on a remote box (either AIX or AS/400)? I have read that DB2 Connect appears to be the ticket for the Db2 server if it is on AS/400 or OS/390. What if it is on AIX? Does the same tool...
4
6475
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to define the servername / hostname in my Perl Progrem.. Here is the code:
3
4568
by: Jassim Rahma | last post by:
I would like to know what is the best way to onnect to connect to a database in general which provides you with full functionality & fast access? Best Regards, Jassim Rahma *** Sent via Developersdex http://www.developersdex.com ***
1
2047
by: GNoter | last post by:
Scenario: I've a WebFarm with 2 web servers which are NLBs (network load balanced). Web1 and Web2; they are not part of a domain. I have a third server, Server3, which is part of a domain and on the same physical network, and it has an MSAccess database which is used on the external webfarm as well as on the internal intranet. I can connect via the intranet because the DB file is on the same box from which the intranet is being served...
21
2344
by: Steve | last post by:
I moved my database from one server to another SQL server. I did a backup and restore of the database. I can connect to the database on server A from my asp.net app but when I try to connect to my database server B, I'm gettting 'login failed for user 'username' I've added the username to the database on server B, I can open up SMS and connect to the database that way, but I can't connect from my asp.net web app. any suggestions on what...
2
9796
by: jeffhan | last post by:
we have os/400 db2 database at the backend. i installed db2 v9 connect server on one windows server which is locating the same network with database server. now how to i configure the connect server and client, so client could access the database through the connect server? like that: db2client <--db2 connect server <--db2 mainframe database
5
3131
by: danfan46 | last post by:
Hi! I have a previous post on the subject that connect takes a long time. I uninstalled db2 completely. Installed V9.5 Installed fixpack 1 created das created an instance installed database sample.
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.