faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Common Problems : .dll Questions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 15 people (53%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Why do I get a 'Type Mismatch' error when I try to pass variables to a dll from my ASP?

Jun 12th, 2000 07:47
Jerry Yoakum,


The variables in your ASP are of type Variant, but in your dll you 
specify a different type.
example (code with error)
------------------------------------------------------------------------
  ASP Code:
    dim pldm(15), i
    for i = 1 to 15
      pldm(i) = objPhePrice.PlateData(i)
      %><br>pldm(<%=i%>) = <%=pldm(i)%><%
    next
  dll Code:
    Public Function PlateData(iIndex As Integer) As Single
------------------------------------------------------------------------
The dll is expecting to receive an Integer but instead gets a Variant. 
To beat this problem use a conversion function.  More more information 
on conversion functions goto the FAQTS: ASP Functions page
<http://www.faqts.com/knowledge-base/index.phtml/fid/409/lang/en>.
example (code without error)
------------------------------------------------------------------------
  ASP Code:
    dim pldm(15), i
    for i = 1 to 15
      pldm(i) = objPhePrice.PlateData(CInt(i))
      %><br>pldm(<%=i%>) = <%=pldm(i)%><%
    next
  dll Code:
    Public Function PlateData(iIndex As Integer) As Single
------------------------------------------------------------------------



© 1999-2004 Synop Pty Ltd