calling function

Discussion in 'C++' started by June Lee, Mar 22, 2008.

  1. June Lee

    June Lee Guest

    how can I call the put_ConnectionString correctly?

    when I do the following I got compile error
    BSTR bstr = "aaa";
    hr.put_ConnectionString(bstr);


    ###################################

    HRESULT CEPGLibApp::LoadXMLData(LPCTSTR tszXMLFileName)
    {
    HRESULT hr = S_OK;

    CComPtr<ISQLXMLBulkLoad> pIXMLBulkLoad;
    hr = CoCreateInstance(CLSID_SQLXMLBulkLoad3, NULL,
    CLSCTX_INPROC_SERVER, IID_ISQLXMLBulkLoad, (void **)&pIXMLBulkLoad);

    if (SUCCEEDED(hr)) {
    BSTR bstr = "aaa";
    hr.put_ConnectionString(bstr);
    }

    if (SUCCEEDED(hr)) {
    }

    if (SUCCEEDED(hr)) {
    }

    return hr;
    }

    ######################################

    ISQLXMLBulkLoad : public IDispatch
    {
    public:
    virtual /* [helpstring][id][propget] */ HRESULT
    STDMETHODCALLTYPE get_ConnectionString(
    /* [retval][out] */ BSTR *pbstrConnectionString) = 0;

    virtual /* [helpstring][id][propput] */ HRESULT
    STDMETHODCALLTYPE put_ConnectionString(
    /* [in] */ BSTR bstrConnectionString) = 0;


    ################################


    typedef /* [wire_marshal] */ OLECHAR *BSTR;

    #################################

    typedef WCHAR OLECHAR;

    ################################
    June Lee, Mar 22, 2008
    #1
    1. Advertising

  2. June Lee

    Alan Johnson Guest

    June Lee wrote:
    > how can I call the put_ConnectionString correctly?
    >
    > when I do the following I got compile error
    > BSTR bstr = "aaa";
    > hr.put_ConnectionString(bstr);
    >
    >
    > ###################################
    >
    > HRESULT CEPGLibApp::LoadXMLData(LPCTSTR tszXMLFileName)
    > {
    > HRESULT hr = S_OK;
    >
    > CComPtr<ISQLXMLBulkLoad> pIXMLBulkLoad;
    > hr = CoCreateInstance(CLSID_SQLXMLBulkLoad3, NULL,
    > CLSCTX_INPROC_SERVER, IID_ISQLXMLBulkLoad, (void **)&pIXMLBulkLoad);
    >
    > if (SUCCEEDED(hr)) {
    > BSTR bstr = "aaa";
    > hr.put_ConnectionString(bstr);
    > }
    >
    > if (SUCCEEDED(hr)) {
    > }
    >
    > if (SUCCEEDED(hr)) {
    > }
    >
    > return hr;
    > }
    >
    > ######################################
    >
    > ISQLXMLBulkLoad : public IDispatch
    > {
    > public:
    > virtual /* [helpstring][id][propget] */ HRESULT
    > STDMETHODCALLTYPE get_ConnectionString(
    > /* [retval][out] */ BSTR *pbstrConnectionString) = 0;
    >
    > virtual /* [helpstring][id][propput] */ HRESULT
    > STDMETHODCALLTYPE put_ConnectionString(
    > /* [in] */ BSTR bstrConnectionString) = 0;
    >
    >
    > ################################
    >
    >
    > typedef /* [wire_marshal] */ OLECHAR *BSTR;
    >
    > #################################
    >
    > typedef WCHAR OLECHAR;
    >
    > ################################



    The only put_ConnectionString declared in the code you show is a member
    of ISQLXMLBulkLoad, which one might infer is a #define for some type of
    class. You are trying to call it, however, as if it were a member of
    HRESULT.

    If I had to guess from context, you probably want to call it as:
    pIXMLBulkLoad->put_ConnectionString(bstr);

    --
    Alan Johnson
    Alan Johnson, Mar 22, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    576
  2. Andreas Lagemann
    Replies:
    8
    Views:
    461
    Mike Wahler
    Jan 10, 2005
  3. tiwy
    Replies:
    0
    Views:
    426
  4. NoWonder
    Replies:
    2
    Views:
    291
    Matthias Kaeppler
    Apr 9, 2005
  5. Satish Chimakurthi

    Function calling another function

    Satish Chimakurthi, Mar 1, 2004, in forum: Python
    Replies:
    2
    Views:
    359
    Satish Chimakurthi
    Mar 1, 2004
Loading...

Share This Page