Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > calling function

Reply
Thread Tools

calling function

 
 
June Lee
Guest
Posts: n/a
 
      03-22-2008
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;

################################
 
Reply With Quote
 
 
 
 
Alan Johnson
Guest
Posts: n/a
 
      03-22-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a function via a pointer-to-function NoWonder C++ 2 04-09-2005 01:40 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM
Calling a global function with the same name as a member function anoopsaha@gmail.com C++ 5 01-05-2005 09:40 AM



Advertisments