Hi All,
Are there samples for working with Inegration Service ?
As I see in shipped samples are C# and VB only.
Particulary I need a C++ code for "Enumerating Available Packages Programmatically"
Thanks a lot.
Sergiy
The code is very similar to C# code, except that instead of using C# classes you should use COM interfaces, declared in DTS.H (from C:\Program Files\Microsoft SQL Server\90\SDK\Include).Here is some code to get you started (I've skipped any error checking for clarity):
#include "dts.h"
void EnumPackages()
{
CComPtr<IDTSApplication90> app;
CComPtr<IDTSPackageInfos90> pkgInfos;
app.CoCreateInstance(__uuidof(Application));
app->GetDtsServerPackageInfos(CComBSTR(L"File System"), CComBSTR(L"."), &pkgInfos);
LONG count;
pkgInfos->get_Count(&count);
printf("found %d packages", count);
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
EnumPackages();
CoUninitialize();
return 0;
}
If you like VC build-in COM support classes, you may #import <dts.tlb> instead of #include <dts.h> - this gives you better wrappers and HRESULT-to-exception translation.
|||HiMichael,
Thanks a lot for answer. It really help.
Sergiy
No comments:
Post a Comment