passing correct value types from ASP/VBScript to VB/DLL

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default passing correct value types from ASP/VBScript to VB/DLL

    Hi All,

    I'm getting an error on my ASP page:

    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'StoreFileIntoField'

    I assume - 99.5% - the error is generated because of worng value types,
    I attemp to pass from my ASP/VBScript page to the VB/DLL function.

    My relevant ASP/VBScript Code is:

    <%
    sTemp = "SomeStringOK"
    mcsSQL = "select * from tbl1"

    ' creates an object ref to the VB/DLL function
    Set obj = Server.CreateObject("SaveCreateFileADO.cStoreCreat eFileADO")

    ' creates a ref' to my recordset object
    Set rs = Server.CreateObject("ADODB.Recordset")

    ' openning the recordset with values of the string connection
    rs.Open mcsSQL, mConn, 1, 3

    With rs
    ..AddNew
    If Not .EOF Then
    'VB5: Dim fldFileName As ADODB.Field
    'VB5: Set fldFileName = .Fields![sFileName] 'set reference to this
    field
    ' vbscript:
    Set fldFileName = rs("sFileName")

    'VB5: Dim fldLongBinary As ADODB.Field
    'VB5: Set fldLongBinary = .Fields![oPicture] 'set a reference to the
    file field
    ' vbscript:
    Set fldFileName = rs("oPicture")

    rs("desc")= now() & "hello"

    With obj
    ' call the VB/DLL
    ' THIS IS the line that generates the ERROR
    If .StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp) Then
    ' do something End If
    End With
    End If
    ..Update
    ..Close
    End With

    %>

    The Function in the VB/DLL is - returns a boolean value -
    StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp)
    suppose to get THESE values types:
    rs VB5: As New ADODB.Recordset
    fldFileName VB5: As ADODB.Field
    fldLongBinary VB5: As ADODB.Field
    sTemp VB5: As String

    My Question is :

    How do I pass the correct value types from ASP/VBScript to VB/DLL,
    using this notion of ADO/ASP 2.0 syntex on PWS 4.0?

    thisis Guest

  2. Similar Questions and Discussions

    1. Total confusion with data types and VBScript
      Hi, I am fighting a data type mismatch problem, which I didn't have an hour ago, and which I do not understand at all. I am using DW MX 2004,...
    2. Disparity between XML Schema types and .Net CLS types
      Hello. The following link lists the mapping of XML Schema types to .Net Framework types:...
    3. passing row types by reference
      Hallo, I´m working with the new informix funcionality that allow use structure data like rows an list rows. I would like to know how I can...
    4. passing javascript variable into asp variable using vbscript
      The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script...
    5. Passing an array from codebehind to vbscript
      Client-side scripting is part of the HTML of the page. All you have to do is loop through the array and build a string of JavaScript that creates...
  3. #2

    Default Re: passing correct value types from ASP/VBScript to VB/DLL


    "thisis" <hellone@ml1.net> wrote in message
    news:1161116027.173418.276860@i3g2000cwc.googlegro ups.com...
    > Hi All,
    >
    > I'm getting an error on my ASP page:
    >
    > Microsoft VBScript runtime error '800a000d'
    > Type mismatch: 'StoreFileIntoField'
    >
    > I assume - 99.5% - the error is generated because of worng value types,
    > I attemp to pass from my ASP/VBScript page to the VB/DLL function.
    >
    > My relevant ASP/VBScript Code is:
    >
    > <%
    > sTemp = "SomeStringOK"
    > mcsSQL = "select * from tbl1"
    >
    > ' creates an object ref to the VB/DLL function
    > Set obj = Server.CreateObject("SaveCreateFileADO.cStoreCreat eFileADO")
    >
    > ' creates a ref' to my recordset object
    > Set rs = Server.CreateObject("ADODB.Recordset")
    >
    > ' openning the recordset with values of the string connection
    > rs.Open mcsSQL, mConn, 1, 3
    >
    > With rs
    > .AddNew
    > If Not .EOF Then
    > 'VB5: Dim fldFileName As ADODB.Field
    > 'VB5: Set fldFileName = .Fields![sFileName] 'set reference to this
    > field
    > ' vbscript:
    > Set fldFileName = rs("sFileName")
    >
    > 'VB5: Dim fldLongBinary As ADODB.Field
    > 'VB5: Set fldLongBinary = .Fields![oPicture] 'set a reference to the
    > file field
    > ' vbscript:
    > Set fldFileName = rs("oPicture")
    >
    > rs("desc")= now() & "hello"
    >
    > With obj
    > ' call the VB/DLL
    > ' THIS IS the line that generates the ERROR
    > If .StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp) Then
    > ' do something End If
    > End With
    > End If
    > .Update
    > .Close
    > End With
    >
    > %>
    >
    > The Function in the VB/DLL is - returns a boolean value -
    > StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp)
    > suppose to get THESE values types:
    > rs VB5: As New ADODB.Recordset
    > fldFileName VB5: As ADODB.Field
    > fldLongBinary VB5: As ADODB.Field
    > sTemp VB5: As String
    >
    > My Question is :
    >
    > How do I pass the correct value types from ASP/VBScript to VB/DLL,
    > using this notion of ADO/ASP 2.0 syntex on PWS 4.0?
    >
    The signature of StoreFileIntoField will define typed byreference
    parameters. The only data type that VBScript supports is variant hence the
    only type that can be passed byref from VBScript is a variant.

    You can do one of the following:-

    1. Change StoreFileIntoField to accept variants
    2. Change StoreFileIntoField to accept it's parameters ByVal (something I
    recommend for most uses anyway even internally to VB6/5)
    3. Place parenthesis around each argument e.g.;-

    StoreFileIntoField((rs), (fldFileName), (fldLongBinary), (sTemp))

    this turns each argument into an expression. Effectively causing them to be
    passed ByVal.

    Option 2 would be my preference.

    Anthony.


    Anthony Jones Guest

  4. #3

    Default Re: passing correct value types from ASP/VBScript to VB/DLL

    Anthony, Thanks for your answer, it's been great help!

    Anthony Jones wrote:
    > "thisis" <hellone@ml1.net> wrote in message
    > news:1161116027.173418.276860@i3g2000cwc.googlegro ups.com...
    > > Hi All,
    > >
    > > I'm getting an error on my ASP page:
    > >
    > > Microsoft VBScript runtime error '800a000d'
    > > Type mismatch: 'StoreFileIntoField'
    > >
    > > I assume - 99.5% - the error is generated because of worng value types,
    > > I attemp to pass from my ASP/VBScript page to the VB/DLL function.
    > >
    > > My relevant ASP/VBScript Code is:
    > >
    > > <%
    > > sTemp = "SomeStringOK"
    > > mcsSQL = "select * from tbl1"
    > >
    > > ' creates an object ref to the VB/DLL function
    > > Set obj = Server.CreateObject("SaveCreateFileADO.cStoreCreat eFileADO")
    > >
    > > ' creates a ref' to my recordset object
    > > Set rs = Server.CreateObject("ADODB.Recordset")
    > >
    > > ' openning the recordset with values of the string connection
    > > rs.Open mcsSQL, mConn, 1, 3
    > >
    > > With rs
    > > .AddNew
    > > If Not .EOF Then
    > > 'VB5: Dim fldFileName As ADODB.Field
    > > 'VB5: Set fldFileName = .Fields![sFileName] 'set reference to this
    > > field
    > > ' vbscript:
    > > Set fldFileName = rs("sFileName")
    > >
    > > 'VB5: Dim fldLongBinary As ADODB.Field
    > > 'VB5: Set fldLongBinary = .Fields![oPicture] 'set a reference to the
    > > file field
    > > ' vbscript:
    > > Set fldFileName = rs("oPicture")
    > >
    > > rs("desc")= now() & "hello"
    > >
    > > With obj
    > > ' call the VB/DLL
    > > ' THIS IS the line that generates the ERROR
    > > If .StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp) Then
    > > ' do something End If
    > > End With
    > > End If
    > > .Update
    > > .Close
    > > End With
    > >
    > > %>
    > >
    > > The Function in the VB/DLL is - returns a boolean value -
    > > StoreFileIntoField(rs, fldFileName, fldLongBinary, sTemp)
    > > suppose to get THESE values types:
    > > rs VB5: As New ADODB.Recordset
    > > fldFileName VB5: As ADODB.Field
    > > fldLongBinary VB5: As ADODB.Field
    > > sTemp VB5: As String
    > >
    > > My Question is :
    > >
    > > How do I pass the correct value types from ASP/VBScript to VB/DLL,
    > > using this notion of ADO/ASP 2.0 syntex on PWS 4.0?
    > >
    >
    > The signature of StoreFileIntoField will define typed byreference
    > parameters. The only data type that VBScript supports is variant hence the
    > only type that can be passed byref from VBScript is a variant.
    >
    > You can do one of the following:-
    >
    > 1. Change StoreFileIntoField to accept variants
    > 2. Change StoreFileIntoField to accept it's parameters ByVal (something I
    > recommend for most uses anyway even internally to VB6/5)
    > 3. Place parenthesis around each argument e.g.;-
    >
    > StoreFileIntoField((rs), (fldFileName), (fldLongBinary), (sTemp))
    >
    > this turns each argument into an expression. Effectively causing them to be
    > passed ByVal.
    >
    > Option 2 would be my preference.
    >
    > Anthony.
    thisis Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139