0
votes

This is the piece of code im having an issue with.

<%=total+((rs("fee_overall")/100)*rs("fee_wip")-rs("fee_rendered"))%>

If any of the data fields are either 0 or NULL then i get a mismatch error

"Microsoft VBScript runtime error '800a000d' Type mismatch: '[string: ""]' "

Any help is apreciated.

Thanks

2
can you provide more info what your code is suppose to do, nobody can guess what your issue is without your full code and explained details, stackoverflow.com/help/how-to-ask - Pupa Rebbe
It is in ASP.... the calculation is using data fields that are on sql. - Lrwit
if the fields are null or 0 than it falls over, however if say - fee_overall = 200, fee_wip = 50, fee_rendered = 25 then i get 75 which is correct... - Lrwit

2 Answers

0
votes

in this case Zero seems to be ok because you have no division by zero. for null variables the standard solution would be that you check if variables are not null , then do calculations:

    if not(isnull(rs("feeoveral")) or isnull( rs("fee_wip")) or isnull(rs("fee_rendered")) ) then
    response.write total+((rs("fee_overall")/100)*rs("fee_wip")-rs("fee_rendered"))
    else
    response.write "bolb"
    end if
0
votes

Try it like this.

    Dim fee_over

    If (IsNull(rs("fee_overall"))) Then
    fee_over = "0"
    Else
    fee_over = (rs("fee_overall"))
    End If
response.write total+((Cint(fee_over))/100)

Also please check that your database record is INT and default 0