Article View: borland.public.cppbuilder.database.multi-tier
Article #1035How can I call the app server function from the client?
From: George Wei
Date: Tue, 11 Jul 2000 00:00
Date: Tue, 11 Jul 2000 00:00
34 lines
1515 bytes
1515 bytes
I wrote an app server as an ActiveX library by using C++ Builder 5. In this
library, I have added a Transactional Data Module, then I implemented a
function as the following codes:
STDMETHODIMP TMIDASServer::foo(void)
{
...
if(...)
return S_OK;
else
return E_FAIL;
}
On the client side, I added a Data Module, then put a DCOMConnection, a
ClientDataSet into it. I tried to use the following codes to call this server
function:
HRESULT hr;
hr=DataModule1->DCOMConnection1->AppServer.Exec(Function("foo"));
if(SUCCEEDED(hr))
ShowMessage("Succeeded.");
else
ShowMessage("Failed.");
The problem is: When the server tries to return S_OK, the client can show the
message correctly; when the server tries to return E_FAIL, the client raises an
EOleSysErr exception with the message "Unspecified error". What's wrong with my
codes?
Another question: I can call the server function as above, is there a similar
function/method in Delphi 5? If it is, how to do that?
Thanks for any help.
Regards,
George
Technical Details
Message-ID:
<8ke8p9$srn1@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,8beacdafd435851e,start X-Google-Attributes: gidfcd2b,public From: gweii@21cn.com (George Wei) Subject: How can I call the app server function from the client? Date: 2000/07/11 Message-ID: <8ke8p9$srn1@bornews.borland.com> X-Deja-AN: 644902314 Organization: SolarWinds User-Agent: Xnews/03.01.23 Newsgroups: borland.public.cppbuilder.database.multi-tier