Link to home
Start Free TrialLog in
Avatar of mike_marquet
mike_marquet

asked on

SQL-DMO link error !

Hi have a problem implementing SQL-DMO in my application.
The linker don't find 2 external symbols : CLSID_SQLDMOServer and IID_ISQLDMOServer.

What is the name of the type library (or DLL) that I must include to my project ?

I am including these 2 files sqldmoid.h and sqldmo.h

The 2 symbols are defined into sqldmo.h

My project is a dialog based application using MFC.
Avatar of mike_marquet
mike_marquet

ASKER

Here's the part that failed :

LPSQLDMOSERVER pSQLServer = NULL;

HRESULT hResult = CoInitialize(NULL);

hResult = CoCreateInstance(CLSID_SQLDMOServer, NULL, CLSCTX_INPROC_SERVER, IID_ISQLDMOServer, (LPVOID)*pSQLServer);
Only ten points?

Well, anyway: you need the IDs header file.

#include <sqldmoid.h>
#include <sqldmo.h>

It's not shipped with VC++; it comes when you install the "development tools" during a client install of SQL.

..B ekiM
I have it and include them. The problem doesn't comes from the compiler but from the link.
ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No it works. But the problem is that when I include this part :

#include <initguid.h>
#include <sqldmoid.h>
#include <sqldmo.h>

in the header, the link don't works. But when I insert it in the cpp file, then it works !!!!!!!!!

I don't know why !

I must include it in the header files, because I have some declaration there.

I have also try to include them in the stdafx.h file but the problem is the same.

It works only when I include them in the same file where the CoCreateInstance is used.

mike_marquet> in the header, the link don't works.

In what header?

What libraries are you specifying to the linker?

What error do you get?

 mike_marquet> It works only when I include them in the same file
 mike_marquet> where the CoCreateInstance is used.

That doesn't make sense. There must be something that you're not telling me. I'd offer to look at your project, but you've only offered ten points.

.B ekiM
- My project is a MFC Dialog based application.
- The header is the dialog once (MyDlg.h).
- The libraries specified are : odbc32.lib version.lib Ws2_32.lib odbccp32.lib
- The error is :
    MyDlg.obj : error LNK2001: unresolved external symbol _CLSID_SQLDMOServer
    MyDlg.obj : error LNK2001: unresolved external symbol _IID_IWSQLDMOServer
mike_marquet,

These questions are still open and our records show you logged in recently. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days. Please note that the recommended minimum for an "Easy" question is 50 points.

https://www.experts-exchange.com/jsp/qShow.jsp?qid=11532221
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11701138
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11841838
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11928102
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11931818
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11996498
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11998538
https://www.experts-exchange.com/jsp/qShow.jsp?qid=12011459
https://www.experts-exchange.com/jsp/qShow.jsp?qid=12039459
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20005590
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20006135
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20071202
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20084832
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20091412
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20093693
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20095151
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20099190
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20099158
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20100338
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20107694
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20114039
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20071199
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20116007
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20128382
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20137131
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20155355
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20192497
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193603
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20238400
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20239471
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20245231
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20253153

EXPERTS: Please leave your thoughts on this question here.

Thanks,

Netminder
Community Support Moderator
Experts Exchange