🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: EOleSysError\Bad variable type

#1078
From: 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
>
>
Technical Details
Message-ID: <393f9fdc@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <393cf9d2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,3411dde974a143d7
X-Google-Attributes: gidfcd2b,public
From: "LSP Engineer" <trudyw@leapfrog-smart.com>
Subject: Re: EOleSysError\Bad variable type
Date: 2000/06/08
Message-ID: <393f9fdc@dnews>
X-Deja-AN: 632604048
References: <393cf9d2@dnews>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-Trace: 8 Jun 2000 06:30:04 -0800, 127.0.0.1
Organization: Leapfrog Smart Products, Inc.
X-MSMail-Priority: Normal
Reply-To: "LSP Engineer" <trudyw@leapfrog-smart.com>
Newsgroups: borland.public.cppbuilder.database.multi-tier