This topic is locked

Custom Expression - Type Mismatch (0x800A000D)

11/1/2007 5:22:48 PM
ASPRunnerPro General questions
J
jtforstner author

Recently migrated back-end from Access to mySQL. Receiving a V-B script runtime error - type mismatch. Any suggestions?
[codebox]Function CustomExpression(strValue, data, field, table)

If table = "" Then table = strTableName

If table = "franchise" And field = "DB" Then

str = "select count() from `DROPBOX` where `FranchiseNbr` ='" & strValue & "' and `DBType` ='PAYMENT'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if not rsTemp(0)=0 then

strValue = "<a href=""java script:createWindow('DROPBOX_view.asp?editid1=" & strValue & "','dropbox','width=470,height=250,scrollbars')""><img border=0 src=images/mail.gif></A>"

else

strValue=""

end if

rsTemp.Close : set rsTemp = Nothing

End If

If table = "franchise" And field = "DBEQ" Then

str = "select count(
) from `DROPBOX` where `FranchiseNbr` ='" & strValue & "' and `DBType` ='EQUIPMENT'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if not rsTemp(0)=0 then

strValue = "<a href=""java script:createWindow('DROPBOX_view.asp?editid1=" & strValue & "','dropbox','width=470,height=250,scrollbars')""><img border=0 src=images/equip.gif></A>"

else

strValue=""

end if

rsTemp.Close : set rsTemp = Nothing

End If

CustomExpression = strValue

End Function[/codebox]

Sergey Kornilov admin 11/2/2007

Does it say what line causes the issue?

J
jtforstner author 11/2/2007

Type mismatch

/interact/include/commonfunctions.asp, line 381

Sergey Kornilov admin 11/2/2007

What is the line 381 in commonfunctions.asp file?

J
jtforstner author 11/5/2007

Here is the offending code, Line 381 is marked in bold.
[codebox] Function CustomExpression(strValue, data, field, table)

If table = "" Then table = strTableName

If table = "franchise" And field = "DB" Then

str = "select count() from `DROPBOX` where `FranchiseNbr`='" & strValue & "' and `DBType`='PAYMENT'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if not rsTemp(0)=0 then

strValue = "<a href=""java script:createWindow('DROPBOX_view.asp?editid1=" & strValue & "','dropbox','width=470,height=250,scrollbars')""><img border=0 src=images/mail.gif></A>"

else

strValue=""

end if

rsTemp.Close : set rsTemp = Nothing

End If

If table = "franchise" And field = "DBEQ" Then

str = "select count(
) from `DROPBOX` where `FranchiseNbr`='" & strValue & "' and `DBType`='EQUIPMENT'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if not rsTemp(0)=0 then

strValue = "<a href=""java script:createWindow('DROPBOX_view.asp?editid1=" & strValue & "','dropbox','width=470,height=250,scrollbars')""><img border=0 src=images/equip.gif></A>"

else

strValue=""

end if

rsTemp.Close : set rsTemp = Nothing

End If

CustomExpression = strValue

End Function[/codebox]

Sergey Kornilov admin 11/5/2007

Make sure this SQL query returns the actual data. Try to print it on the web page instead of executing.

J
jtforstner author 11/5/2007

It's printing properly. I've uploaded this to my demo account if you could take a look. It's the franchise_list page. jforstner@mn.uscable.com

Sergey Kornilov admin 11/5/2007

Please send the URL to support@xlinesoft.com.