Type mismatch - Microsoft VBScript runtime error '800a000d'

R

Red_Star20

I am getting this type mismatch error and not sure why?!
The last line is the one causing the error... I am trying to get those
values from an Oracle database and add/subtract their values.

<% InAcademic =rsDataSet("In_Academic")
InNonAcademic =rsDataSet("In_Non_Academic")
FinancialAid =rsDataSet("Financial_Aid")
%>
<% AmountDue = InAcademic + InNonAcademic - FinancialAid %>
 
S

Stefan B Rusynko

Are you sure all 3 fields are at least an integer field and none of them can ever be empty or null
- or try to force a conversion to Integer using Cint

InAcademic =Cint(rsDataSet("In_Academic"))


Check them (where "var" is your actual variable name - say "FinancialAid") with either
Response.write TypeName("var")
or
Response.write VarType("var")




|I am getting this type mismatch error and not sure why?!
| The last line is the one causing the error... I am trying to get those
| values from an Oracle database and add/subtract their values.
|
| <% InAcademic =rsDataSet("In_Academic")
| InNonAcademic =rsDataSet("In_Non_Academic")
| FinancialAid =rsDataSet("Financial_Aid")
| %>
| <% AmountDue = InAcademic + InNonAcademic - FinancialAid %>
|
 
R

Red_Star20

You were right, but instead of using CInt I have to use CLng for decimals.
What if however some of the fields are empty... How can I handle them? Using
the CLng gives me an error in case of empty fields. Any ideas?
 
K

Kevin Spencer

If IsNull(rsDataSet("In_Academic").Value) Then
InAcademic = 0
Else
InAcademic = rsDataSet("InAcademic").Value
end If

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
R

Red_Star20

I guess that works, I just thought there was a different way of doing it too..
Thanks
 
C

Conrad

You can also check to see if what you are trying to convert is a number.

If IsNumeric(rs("Field")) Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top