none
ODBC Dialog (DataLink) RRS feed

  • Pergunta

  • Estou tentando acessar a janela de conexões para obter a string de conexão, porém não está funcionando no meu código. Estou obtendo os seguintes erros de compilação:

    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(257): error C2065: 'IDataSourceLocatorPtr' : undeclared identifier
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(257): error C2146: syntax error : missing ';' before identifier 'dlPrompt'
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(257): error C2065: 'dlPrompt' : undeclared identifier
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(259): error C2228: left of '.CreateInstance' must have class/struct/union type
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(259): error C3861: 'dlPrompt': identifier not found, even with argument-dependent lookup
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(260): error C2227: left of '->PromptNew' must point to class/struct/union
    c:\Documents and Settings\Luis Alberto Pereira\My Documents\Visual Studio Projects\A3DBIPrm\T130_DlgPrmGraf.cpp(260): error C3861: 'dlPrompt': identifier not found, even with argument-dependent lookup

    Meu código:

    #import "C:\Program Files\Common Files\system\ole db\Oledb32.dll"  raw_interfaces_only exclude("IDBPromptInitialize", "IDataInitialize") no_auto_exclude
    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename("EOF", "EndOfFile")
    #import "C:\Program Files\Common Files\System\ado\MSJRO.DLL" no_namespace

    ...

     HRESULT hr;
        ::CoInitialize( NULL );
        IDataSourceLocatorPtr dlPrompt = NULL;
        _ConnectionPtr conn = NULL;
        hr = dlPrompt.CreateInstance(__uuidof(DataLinks));
        conn = dlPrompt->PromptNew();
        if ( NULL != conn )
        {
         printf( "Connect: %s\n", (char*) conn->ConnectionString );
        }

    Alguem pode me ajudar no problema ?  Este codigo funciona no projeto que exemplo que peguei na internet, porém no meu nao funciona.

    Obrigado,

    Luis

    quinta-feira, 21 de setembro de 2006 01:29