• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

SQLDMO connect code works in 2000, not in 2005

Hi all

I have the below Access code snippet working for SQL 2000 servers, but not SQL 2005.  Does anyone have experience with this?

Dim oServer As SQLDMO.SQLServer
Set oServer = New SQLDMO.SQLServer

oServer.LoginSecure = True

'The below line works for 2000 servers, but produces a 'To connect to this server you must use SQL Server Management Studio or SQL Server Management Objects (SMO) errmsg for 2005 servers
oServer.Connect "SomeServerName"

Thanks in advance.
Jim



 
0
Jim Horn
Asked:
Jim Horn
  • 2
  • 2
1 Solution
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
Remember that usually SMO is backward compatible, but not forward compatible.  The code that you have is friendly to SQL 2000, but not 2005.  And in this case, you are using DMO which is replaced by SMO.  You need to have the SMO components in order to connect to some of the items in SQL 2005, so you need to get the 2005 SMO components and you should be good.  The other thing to remember is that SQL 2005 SMO will almost always work on SQL 2000.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
Okay, thanks.  Do you have a SMO code snippet that accomplishes the above?
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
I have a working solution.

In Access VBA code I'm able to determine if this is a 2000 vs. 2005 database.
If 2000, I retain the original SQL-DMO code that works fine.
If 2005, I use an ADODB.Connection to connect to that server's master db, then query the sys.databases view to get the list.

Unless I see some SMO code that pulls this off, I'll request a PAQ-Refund in a couple of days.
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
The other side to SMO is that it is managed code, so it would be in the CLR space and not necessarily accessible from Access.  I believe that you could do it from Access 2007, but it would not be VBA.

So you would be well off using DMO and then your ADODB if you are using Access and VBA.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now