🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
2 messages
2 total messages Started by LSP Engineer Tue, 06 Jun 2000 00:00
EOleSysError\Bad variable type
#1073
Author: LSP Engineer
Date: Tue, 06 Jun 2000 00:00
46 lines
2060 bytes
When executing the following code, the application on my computer encounters
this exception while on other computers in-house, the code behaves properly.

Here is the code

    AnsiString TAppDataModule::getQOD()
    {
      const OleVariant olvInput = Null;
      OleVariant olvResult;
      WideString wsQOD;

      if (!QODMasterDataSet->Active)
           QODMasterDataSet->Open();

      QODMasterDataSet->Provider->DataRequest(olvInput, olvResult);  <---THIS IS
THE LINE THAT EXCEPTS!!!
      wsQOD = (WideString)olvResult;

      return (AnsiString)wsQOD;
    }

My machine already encountered the known error with the utilcls.h file and the
other PCs
in-house didn't.  The installation of service pack1 created an error in the
*impl file's exported
routine for a TProvider component--->
          STDMETHODIMP TxxxIMPL::Func1(IProviderPtr* Value).
Found this in the Borland FAQs "CBuilder4 Patch Broke MIDAS"
(http://community.borland.com/article/0,1410,10305,00.html).  The other
machine's have
service pack1 installed as well, but my machine had BoundsChecker at one time (I
had to remove it,
for various reasons)

So, its my guess that my PC is finding yet another error incorporated by service
pack1.  I believe the
problem lies with OleVariants and Variants types.

Thanks is advance,


--
Trudy Reiser
trudyw@leapfrog-smart.com
Leapfrog Smart Products, Inc.
Building Smart Solutions for a Dynamic World
Re: EOleSysError\Bad variable type
#1078
Author: LSP Engineer
Date: Thu, 08 Jun 2000 00:00
94 lines
3431 bytes
Fixed my own problem...thought I'd share it if anyone cares...

On the provider side (Server), I converted the variant to an AnsiString and
Trimmed it (.Trim())
Then sent back the vstr (not the v variable)
It seems variants have a lot of trailing white space.

Here's the code:
OleVariant __fastcall TServerDataModule::QODMasterProviderDataRequest(
      TObject *Sender, OleVariant &Input)
{

  Variant v;
  AnsiString vstr = "";

  if (!QODMasterProvider->DataSet->Active)
       QODMasterProvider->DataSet->Open();

  v = QODMasterProvider->DataSet->Lookup("marked", (Variant)1, "quote");

  if ( v.IsNull() )
      {

       v = "Today you get no Quote Of the Day";

      }
  else                                                <--ADDED THIS LINE
    vstr = VarToStr(v).Trim();              <--ADDED THIS LINE


//  return (OleVariant)v;                      <--CHANGED THIS LINE TO
    return (OleVariant)vstr;                   <--THIS LINE
}

The Client can now display the QOD text without excepting...
--
Trudy Reiser
trudyw@leapfrog-smart.com
Leapfrog Smart Products, Inc.
Building Smart Solutions for a Dynamic World

"LSP Engineer" <trudyw@leapfrog-smart.com> wrote in message
news:393cf9d2@dnews...
> When executing the following code, the application on my computer encounters
> this exception while on other computers in-house, the code behaves properly.
>
> Here is the code
>
>     AnsiString TAppDataModule::getQOD()
>     {
>       const OleVariant olvInput = Null;
>       OleVariant olvResult;
>       WideString wsQOD;
>
>       if (!QODMasterDataSet->Active)
>            QODMasterDataSet->Open();
>
>       QODMasterDataSet->Provider->DataRequest(olvInput, olvResult);  <---THIS
IS
> THE LINE THAT EXCEPTS!!!
>       wsQOD = (WideString)olvResult;
>
>       return (AnsiString)wsQOD;
>     }
>
> My machine already encountered the known error with the utilcls.h file and the
> other PCs
> in-house didn't.  The installation of service pack1 created an error in the
> *impl file's exported
> routine for a TProvider component--->
>           STDMETHODIMP TxxxIMPL::Func1(IProviderPtr* Value).
> Found this in the Borland FAQs "CBuilder4 Patch Broke MIDAS"
> (http://community.borland.com/article/0,1410,10305,00.html).  The other
> machine's have
> service pack1 installed as well, but my machine had BoundsChecker at one time
(I
> had to remove it,
> for various reasons)
>
> So, its my guess that my PC is finding yet another error incorporated by
service
> pack1.  I believe the
> problem lies with OleVariants and Variants types.
>
> Thanks is advance,
>
>
> --
> Trudy Reiser
> trudyw@leapfrog-smart.com
> Leapfrog Smart Products, Inc.
> Building Smart Solutions for a Dynamic World
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads