Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2004, 03:09 AM
Authorized User
 
Join Date: Jul 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQLDMO: SQL2000 & VBNet2002 Std. SP2


'Use the SQL DMO Application Object to find the available SQL Servers
        Try
            Dim i As Integer
            Dim oNames As SQLDMO.NameList
            Dim oSQLApp As SQLDMO.Application
            oSQLApp = New SQLDMO.Application()

            oNames = oSQLApp.ListAvailableSQLServers
            cboServer.Items.Clear()
            For i = 0 To oSQLApp.ListAvailableSQLServers.Count
                cboServer.Items.Add(oSQLApp.ListAvailableSQLServer s.Item(0))
            Next i
        Catch err As Exception
            MsgBox(err.Message)
        End Try

I got this Error
QueryInterface for interface SQLDMO.NameList failed.

Any problem with code or SQLDMO it self not compatible to VBNet.

Need to Execute DMO very Badly

Proud To Be Pinoy
__________________
Proud To Be Pinoy
 
Old September 18th, 2004, 04:43 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I can see a few of things wrong, mainly the method ListAvailableSQLServers is very costly, you on ly need to call it once not three times, you never use i and the NameList is a one-based collection:
Code:
Dim i As Integer
Dim oSQLApp As SQLDMO.Application
oSQLApp = New SQLDMO.Application()
Dim colNames As SQLDMO.NameList
colNames = oSQLApp.ListAvailableSQLServers()
For i = 1 To colNames.Count
  cboServer.Items.Add(colNames(i)
Next i
--

Joe
 
Old September 21st, 2004, 01:18 AM
Authorized User
 
Join Date: Jul 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Still, It fails in this part

colNames = oSQLApp.ListAvailableSQLServers()

"QueryInterface for interface SQLDMO.NameList failed"


Proud To Be Pinoy
 
Old September 21st, 2004, 02:10 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Assuming you are running SQL Server 2000 you should make sure that you have installed SQL 2000 Service Pack 2 or better still SP3.
--

Joe
 
Old September 21st, 2004, 07:55 PM
Authorized User
 
Join Date: Jul 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok. thank you very much for the responses

Proud To Be Pinoy
 
Old September 21st, 2004, 09:14 PM
Authorized User
 
Join Date: Jul 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Much have been asked/Written about ADONet for VBnet but less on SQLDMO/SQLNS. Where can we find articles regarding SQLDMO/SQLNS for VBNet matter?
(Trying to create a security app in VBNet using SQLDMO/NS for SQL Server & MSDE Apps)

Proud To Be Pinoy





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem With SQLDMO in VBNet toanquyen VS.NET 2002/2003 0 April 17th, 2007 07:18 AM
Excel 2002 Sp1 & Excel Sp2 anup.bihani Excel VBA 0 November 23rd, 2006 04:48 AM
VB.Net 2002 Std and Crystal 9 Prof HELP reyboy Crystal Reports 0 April 21st, 2005 05:32 AM
SQLDMO Connection Problem madhanagopal Pro VB.NET 2002/2003 0 September 14th, 2004 04:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.