Ask a Question related to ASP Components, Design and Development.
-
thisis #1
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
-
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,... -
Disparity between XML Schema types and .Net CLS types
Hello. The following link lists the mapping of XML Schema types to .Net Framework types:... -
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... -
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... -
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... -
Anthony Jones #2
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...The signature of StoreFileIntoField will define typed byreference> 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?
>
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
-
thisis #3
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



Reply With Quote

