|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Alex Shevchuk (ashevchuk
CORILLIAN.COM)Date: Tue Oct 02 2001 - 11:02:15 CDT
http://discuss.microsoft.com/SCRIPTS/WA-MSD.EXE?A2=ind0109C&L=ATL&P=R1829
[in, out] have to be VARIANT*. Otherwise you're
loosing ability to use variables.
Alex Shevchuk
> -----Original Message-----
> From: Howard Pinsley [mailto:HPinsley
KAYESCHOLER.COM]
> Sent: Tuesday, October 02, 2001 8:48 AM
> To: DCOM
DISCUSS.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-request
DISCUSS.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-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]