473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Type Mismatch

Ray
I'm at my wits end here. I am getting type mismatch error
in a ASP page when I try to multiply decimals*integers.
This shouldn't be this difficult. I have tried the
conversion functions, changed the datatypes in the
pages..Help!!!!
Jul 19 '05 #1
7 7048
show the exact code, and the numbers once....
--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Ray" <rl*****@quantumresources.net> wrote in message
news:05****************************@phx.gbl...
I'm at my wits end here. I am getting type mismatch error
in a ASP page when I try to multiply decimals*integers.
This shouldn't be this difficult. I have tried the
conversion functions, changed the datatypes in the
pages..Help!!!!

Jul 19 '05 #2

Is this what you meant?

salaryexpense=(assignlength)*(avghours)*(st)

assignlength, avghours and st are read from the table.

table definitions
assignlength INT
avghours INT
st decimal
current values

assignlength = 52
avghours = 40
st = 10.00

if i response.write each value they come out like they should, but as
soon as i try to multiply them..mismatch error. Driving me nuts..

Thanks
Ray


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
salaryexpense=CInt(assignlength)*CInt(avghours)*CI nt(st)

Does that work?
Are you sure there are no NULL values?

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Ray Little" <rl*****@quantumresources.net> wrote in message
news:Ok*************@TK2MSFTNGP12.phx.gbl...

Is this what you meant?

salaryexpense=(assignlength)*(avghours)*(st)

assignlength, avghours and st are read from the table.

table definitions
assignlength INT
avghours INT
st decimal
current values

assignlength = 52
avghours = 40
st = 10.00

if i response.write each value they come out like they should, but as
soon as i try to multiply them..mismatch error. Driving me nuts..

Thanks
Ray


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4
Cdbl() perhaps?

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Ray Little" <rl*****@quantumresources.net> wrote in message
news:ub*************@tk2msftngp13.phx.gbl...
not sure the first response went through..but...

if i change all of those to CInt i have been able to get that to work.
The issue is with the ST which is decimal. The value of say 32.50 will
change to 32 throwing the calculation off.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #5
Ray Little wrote:
not sure the first response went through..but...

if i change all of those to CInt i have been able to get that to work.
The issue is with the ST which is decimal. The value of say 32.50 will
change to 32 throwing the calculation off.

What is salaryexpense? Is that a variable?
We're really guessing here. We need to see some more code. If I run this
code in my test asp page:
<%
dim assignlength,avghours, st,salaryexpense
assignlength = cint(52)
avghours = cint(40)
st=10.00
salaryexpense = assignlength * avghours * st
Response.Write salaryexpense
Response.End
%>

I get this result in the browser window:
20800

So if you want help, you are going to have to show us how to reproduce your
error.

Bob Barrows
Jul 19 '05 #6
greatly appreciate the help..
yes..its just a variable..here is the code all the way down to that
variable. Here are the results of the response.write before it errors
out...

52 pp 40 pp 10
Coded as follows:
pmodelid=request.querystring("id")
SQL = "SELECT * FROM xxxx WHERE pmodel_id = " & pmodelid & ";"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
company = rs("client_name")
employee = rs("empl_name")
assignlength = rs("assign_length")
vacations = (rs("vacation"))
holidays = (rs("holidays"))
dateplaced = rs("date_placed")
avghours = rs("hours")
compcode = rs("work_code")
state = rs("work_state")
st = rs("st_rate")
otf = (rs("ot_factor"))
perdiem = (rs("perdiem"))
hw = (rs("hardware"))
sw = (rs("software"))
other = rs("insurance")
oth = (rs("onetime"))
branchst = (rs("burden_rate"))
commission = (rs("com_rate"))
dlc1 = (rs("st_dlcmkup"))
dlc2 = (rs("ot_dlcmkup"))
brlocation=rs("branch")
moneycost=rs("money_days")
moneyrate=(rs("money_rate"))
pricingadminid=rs("sales_id")
projpositions=cint(rs("positions"))
statusflag=rs("statusflag")
statusdate=rs("statusdate")
rs.movenext
wend
rs.close
SQL = "SELECT * FROM xxxxxxx WHERE id = '" & compcode & "';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
wrkcrate=rs("rate")
workcdesc=rs("ratedesc")
rs.movenext
wend
rs.Close

wcdesc=wccode&" "&workcdesc

SQL = "SELECT * FROM xxxxxxxx WHERE id = 'MEDICR';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
medicarate=rs("rate")
rs.movenext
wend
rs.Close

SQL = "SELECT * FROM xxxxxxxxx WHERE id = 'FUTA';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
futarate=rs("rate")
futalimit=rs("wage")
rs.movenext
wend
rs.Close

SQL = "SELECT * FROM xxxxxxxx WHERE id = 'UCC-"&state&"';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
uccrate=rs("rate")
ucclimit=rs("wage")
rs.movenext
wend
rs.Close
SQL = "Select userid from xxxxxxx where user_num = " & pricingadminid
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
pricingadminname=rs("userid")
rs.movenext
wend
rs.Close
'formula variables
response.write assignlength&" pp "&(avghours)&" pp "&st

salaryexpense=(assignlength)*(avghours)*(st)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #7
Try to filter each of the three variables using something like this:

If IsNull(avghours) Or Not IsNumeric(avghours) Or avghours = "" Then
avghours = 0
Else
avghours = CDbl(avghours)
End If
Response.write avghours

Check your table structure and see if anything is returning a string or
Null.

Shailesh

Ray Little wrote:
greatly appreciate the help..
yes..its just a variable..here is the code all the way down to that
variable. Here are the results of the response.write before it errors
out...

52 pp 40 pp 10
Coded as follows:
pmodelid=request.querystring("id")
SQL = "SELECT * FROM xxxx WHERE pmodel_id = " & pmodelid & ";"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
company = rs("client_name")
employee = rs("empl_name")
assignlength = rs("assign_length")
vacations = (rs("vacation"))
holidays = (rs("holidays"))
dateplaced = rs("date_placed")
avghours = rs("hours")
compcode = rs("work_code")
state = rs("work_state")
st = rs("st_rate")
otf = (rs("ot_factor"))
perdiem = (rs("perdiem"))
hw = (rs("hardware"))
sw = (rs("software"))
other = rs("insurance")
oth = (rs("onetime"))
branchst = (rs("burden_rate"))
commission = (rs("com_rate"))
dlc1 = (rs("st_dlcmkup"))
dlc2 = (rs("ot_dlcmkup"))
brlocation=rs("branch")
moneycost=rs("money_days")
moneyrate=(rs("money_rate"))
pricingadminid=rs("sales_id")
projpositions=cint(rs("positions"))
statusflag=rs("statusflag")
statusdate=rs("statusdate")
rs.movenext
wend
rs.close
SQL = "SELECT * FROM xxxxxxx WHERE id = '" & compcode & "';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
wrkcrate=rs("rate")
workcdesc=rs("ratedesc")
rs.movenext
wend
rs.Close

wcdesc=wccode&" "&workcdesc

SQL = "SELECT * FROM xxxxxxxx WHERE id = 'MEDICR';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
medicarate=rs("rate")
rs.movenext
wend
rs.Close

SQL = "SELECT * FROM xxxxxxxxx WHERE id = 'FUTA';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
futarate=rs("rate")
futalimit=rs("wage")
rs.movenext
wend
rs.Close

SQL = "SELECT * FROM xxxxxxxx WHERE id = 'UCC-"&state&"';"
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
uccrate=rs("rate")
ucclimit=rs("wage")
rs.movenext
wend
rs.Close
SQL = "Select userid from xxxxxxx where user_num = " & pricingadminid
Set rs = conn.execute(SQL)
conn.execute(SQL)
while not rs.eof
pricingadminname=rs("userid")
rs.movenext
wend
rs.Close
'formula variables
response.write assignlength&" pp "&(avghours)&" pp "&st

salaryexpense=(assignlength)*(avghours)*(st)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.