?
Solved

SQLDMO connect code works in 2000, not in 2005

Posted on 2008-11-18
4
Medium Priority
?
404 Views
Last Modified: 2012-05-05
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
Comment
Question by:Jim Horn
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 22989483
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
 
LVL 66

Author Comment

by:Jim Horn
ID: 22993917
Okay, thanks.  Do you have a SMO code snippet that accomplishes the above?
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 0 total points
ID: 22995379
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
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 23001359
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question