OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Tim Tabor (tltaborNYC.RR.COM)
Date: Tue Oct 02 2001 - 11:01:42 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    http://discuss.microsoft.com/SCRIPTS/WA-MSD.EXE?A2=ind0009D&L=ATL&P=R31818

    http://discuss.microsoft.com/SCRIPTS/WA-MSD.EXE?A2=ind9709C&L=ATL&P=R5574

    HTH

    // tim

    > -----Original Message-----
    > From: Distributed COM-Based Code [mailto:DCOMDISCUSS.MICROSOFT.COM]On
    > Behalf Of Howard Pinsley
    > Sent: Tuesday, October 02, 2001 11:48 AM
    > To: DCOMDISCUSS.MICROSOFT.COM
    > Subject: VBScript Enigma
    >
    >
    > I never seem to get a handle on the limitations of VBScript. I have been
    > given a component that implements a dual interface where one of
    > the methods
    > is defined as follows:
    >
    > HRESULT ConnectSQL(
    > [in, out] BSTR* errMsg,
    > [in, out, optional] BSTR* connectStr,
    > [in, out, optional] BSTR* dsnUID,
    > [in, out, optional] BSTR* dsnPWD,
    > [in, out, optional] BSTR* dsnName,
    > [out, retval] VARIANT_BOOL* );
    >
    > I have no problems calling this method with early binding. Here is what's
    > driving me crazy with vbscript/late binding.
    >
    > Here objMailer has successfully been created with WScript.CreateObject:
    >
    > Succeeds
    > =======
    > If (objMailer.ConnectSQL("","DRIVER={SQL Server};SERVER=...")) Then ...
    >
    > but
    >
    > Fails
    > ====
    > connectStr = "DRIVER={SQL Server};SERVER=..."
    > If (Not objMailer.ConnectSQL("",connectStr)) Then ...
    > yields type mismatch error 0x800A000D
    >
    > I can pass a string constant but not a variable (which is by definition a
    > variant) containing a string? I could swear I could do this before.
    >
    > Incidentally, I get the same type mismatch errror if I attempt to use a
    > variable for the first BSTR parameter.
    > errMsg=""
    > If (Not objMailer.ConnectSQL(errMsg,"DRIVER={SQL
    > Server};SERVER=...")) Then
    > ...
    >
    > What is the explanation for this? Why can I pass string constants but not
    > variables. Also, the intent of the first parameter is to provide for an
    > output error message. Is there no way to get this with a VBScript client?
    > I'm wondering if this is because the BSTR's are all declared with [,out].
    > The vendor has defined the interface this way even though only the first
    > parameter should (I believe) really be declared as such.
    >
    > TIA
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM