🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #948

What's wrong with the code in my C++ Builder 5 project?

#948
From: George Wei
Date: Sun, 24 Sep 2000 00:00
73 lines
2607 bytes
I am sorry for that I have to post this message into both the C++ Builder & 
the Delphi groups. I just want more gurus can view this and give me the 
answer.
I have written a Application server by using delphi, and I added a new 
function in it, it declared as:

function VerifyPassword(const Username: WideString; const Password: 
WideString): OleVariant; dispid 1;

And it implemented as:

function TMIDASServer.VerifyPassword(const Username,
  Password: WideString): OleVariant;
var
  S : String;
begin
  if(ADOQuery1.Active=true) then
    ADOQuery1.Close;
  ADOQuery1.Parameters.ParamByName('Username').Value:=UpperCase(Username);
  ADOQuery1.Open;
  S:=ADOQuery1.Fields.FieldByName('PASSWORD').AsString;
  ADOQuery1.Close;
  if(S=String(Password)) then
    result:=S_OK
  else
    result:=E_FAIL;
end;

Then I wrote a client program by using delphi to call this function, just 
like the following:

procedure TForm1.btnVerifyClick(Sender: TObject);
var
  hr : HRESULT;
begin
  DMod1.DCOMConnection1.Connected:=true;
  hr:=DMod1.DCOMConnection1.AppServer.VerifyPassword(edtUsername.Text,edtPa
ssword.Text);
  if(SUCCEEDED(hr)) then
    ShowMessage('Succeeded.')
  else
    ShowMessage('Failed.');
end;

It works OK!
***The real problem is the following:***
Then I wrote a client by using C++ Builder which is similar to the previous 
one. The calling function is implemented as:

void __fastcall TForm1::btnVerifyClick(TObject *Sender)
{
  HRESULT hr;

  DMod1->DCOMConnection1->Connected=true;
  hr=DMod1->DCOMConnection1-
>AppServer.Exec(Function("VerifyPassword")<<WideString(edtUsername->Text)
                                                                      <<Wid
eString(edtPassword->Text));
  if(SUCCEEDED(hr))
    ShowMessage("Succeeded.");
  else
    ShowMessage("Failed.");
}

When I tried to make it, the linker gave the following imformation:

[Linker error] Unresolved external '_Module' referenced from 
D:\BORLAND\CBUILDER5\LIB\BCBATL.LIB|bcbatllib

What's wrong with my code? If you want the source code, please write to me.
Thanks for any help.

George
Technical Details
Message-ID: <8ql3o0$rk63@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,5dc0508b8b09af62,start
X-Google-Attributes: gidfcd2b,public
From: gweii@21cn.com (George Wei)
Subject: What's wrong with the code in my C++ Builder 5 project?
Date: 2000/09/24
Message-ID: <8ql3o0$rk63@bornews.borland.com>
X-Deja-AN: 673522360
Organization: Another Netscape Collabra Server User
User-Agent: Xnews/03.08.12
Newsgroups: borland.public.cppbuilder.database.multi-tier