473,385 Members | 1,907 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,385 software developers and data experts.

How to use the ListAvailableSqlServers in c#

Here is my code:

///////////////////////////////////////////////////////////////////////////
SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}

///////////////////////////////////////////////////////////////////////////
The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?

Nov 16 '05 #1
5 3031
hi
Use COM interop to call SQL-DMO. It can enumerate servers.

also check this article
http://www.csharphelp.com/archives2/archive342.html

regards
Ansil
Dimensions Technopark Trivandrum
an****@gmail.com

"ch**@163.com" wrote:
Here is my code:

///////////////////////////////////////////////////////////////////////////
SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}

///////////////////////////////////////////////////////////////////////////
The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?

Nov 16 '05 #2
Time to install the SQL client from the latest SP for SQL server 2000.

Willy.

<ch**@163.com> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

///////////////////////////////////////////////////////////////////////////
SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}

///////////////////////////////////////////////////////////////////////////
The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?

Nov 16 '05 #3
I have read your article about the SQL-DMO at your web site ,And I tried
your code in my program ,but the
same error occured ,Can you tell me why ?
Error :Queryinterface is failed of the SQLDMO.NameList

"Ansil MCAD" <An*******@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ
:A0**********************************@microsoft.co m...
hi
Use COM interop to call SQL-DMO. It can enumerate servers.

also check this article
http://www.csharphelp.com/archives2/archive342.html

regards
Ansil
Dimensions Technopark Trivandrum
an****@gmail.com

"ch**@163.com" wrote:
Here is my code:

/////////////////////////////////////////////////////////////////////////// SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}

/////////////////////////////////////////////////////////////////////////// The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?

Nov 16 '05 #4
I have read your article about the SQL-DMO at your web site ,And I tried
your code in my program ,but the
same error occured ,Can you tell me why ?
Error :Queryinterface is failed of the SQLDMO.NameList

"Ansil MCAD" <An*******@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ
:A0**********************************@microsoft.co m...
hi
Use COM interop to call SQL-DMO. It can enumerate servers.

also check this article
http://www.csharphelp.com/archives2/archive342.html

regards
Ansil
Dimensions Technopark Trivandrum
an****@gmail.com

"ch**@163.com" wrote:
Here is my code:

/////////////////////////////////////////////////////////////////////////// SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}

/////////////////////////////////////////////////////////////////////////// The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?

Nov 16 '05 #5
This is a known problem, solved a couple of years ago with a SP for SQL2000.

Willy.

<ch**@163.com> wrote in message
news:u$**************@TK2MSFTNGP11.phx.gbl...
I have read your article about the SQL-DMO at your web site ,And I tried
your code in my program ,but the
same error occured ,Can you tell me why ?
Error :Queryinterface is failed of the SQLDMO.NameList

"Ansil MCAD" <An*******@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ
:A0**********************************@microsoft.co m...
hi
Use COM interop to call SQL-DMO. It can enumerate servers.

also check this article
http://www.csharphelp.com/archives2/archive342.html

regards
Ansil
Dimensions Technopark Trivandrum
an****@gmail.com

"ch**@163.com" wrote:
> Here is my code:
>
> /////////////////////////////////////////////////////////////////////////// > SQLDMO._Application SqlServer = new ApplicationClass();
> try
> {
>
> SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();
>
> for(int i=0;i<servers.Count;i++)
> MessageBox.Show(servers.Item(i));
>
> }
> catch(Exception e)
> {
> MessageBox.Show(e.ToString());
> }
>
>
>
> /////////////////////////////////////////////////////////////////////////// > The compiler tell me : Queryinterface is failed of the SQLDMO.NameList
>
> What shall I do ?
>
>
>
>


Nov 16 '05 #6

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

Similar topics

6
by: Job Lot | last post by:
Using VB.NET how can I find all available SQL Server on a local network and list all the databases in each server. Thanks
11
by: arfanameer | last post by:
I have been using SQLDMO listavailableSQLServers . It displays all the servers but it doesnt list the local machine in which SQL Server too is running. Am i missin something?
2
by: musachy | last post by:
My application uses sqldmo to retrieve the list of sql servers in the network, it works fine in some machines, but it is crashing the application in others, no error and no exception, it shuts down...
2
by: Bishman | last post by:
Can anyone suggest a method of enumerating instances of MSDE 2000 without using DMO ? Using C++, MFC, and ADO. Thanks
5
by: Oliver Braun | last post by:
I know this is a very common issue and I found a lot of hints on this topic in www but I did not find a very good solution for this task. Most of the solutions use SQLDMO to list all sql servers...
6
by: Reza Alirezaei | last post by:
How can I have a list of all sql servers avaiable on our LAN populated in a DropDownList exacly like what we have when we want to specify Datasource in ADO.Net or wherever? Thanks
5
by: Christian Pické | last post by:
Hi, I want to deploy my Windows Application written in C#. I am using SQL Server and I wonder if there is a way to detect computers that run SQL Server or MSDE, so I can connect to them 1) to...
6
by: LIN | last post by:
is there an .NET equivalent of SQLDMO ? ideas please. thanks! LIN
1
by: Craig G | last post by:
i have the following code in a form load event, that (should) simply populate a combobox with the names of all SQL servers on the network Dim x As Long Dim sqlNameList As SQLDMO.NameList ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.