Solved

Type mismatch: 'cdec'

Posted on 2002-03-06
8
1,590 Views
Last Modified: 2008-03-03
Hi.

Type mismatch: 'cdec'

Here is the code:
ProductId = 262555561
OpLocationId = 2
InternalTime = trim(Request.Form("InsertInternalTime"))
InternalYield = trim(Request.Form("InsertInternalYield"))
CustomerTime = trim(request.Form("InsertCustomerTime"))
CustomerYield =trim(Request.Form("InsertCustomerYield"))
EditedTime =  Now()


if isnumeric(InternalTime) or isnumeric(InternalYield) or isnumeric(CustomerTime) or isnumeric(CustomerYield) then
  InternalTime = cdec(InternalTime)
  InternalYield = cdec(InternalYield)
  CustomerTime = cdec(CustomerTime)
  CustomerYield = cdec(CustomerYield)  
else
  'it isn't numeric
end if

remoteconn.execute "INSERT OpRegister (ProductId, OpLocationId, InternalTime, InternalYield, CustomerTime, CustomerYield, EditedDate) VALUES ('" & ProductId & "','" & OpLocationId & "'," & InternalTime & " ,'" & InternalYield & "','" & CustomerTime & "','" & CustomerYield & "','" & EditedDate & "')"


Why error?
0
Comment
Question by:sporfex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 4

Expert Comment

by:ruperts
ID: 6843845
if isnumeric(InternalTime) and isnumeric(InternalYield) and isnumeric(CustomerTime) and isnumeric(CustomerYield)
then
 InternalTime = clng(InternalTime)
 InternalYield = clng(InternalYield)
 CustomerTime = clng(CustomerTime)
 CustomerYield = clng(CustomerYield)  
else
 'it isn't numeric
end if
0
 

Author Comment

by:sporfex
ID: 6843850
But I recive error if is just use (below) also:

if isnumeric(InternalTime) then

InternalTime = clng(InternalTime)

else
'it isn't numeric
end if

Type mismatch: 'cdec'
/operationsregister/insert.inc, line 35

That is this line : InternalTime = clng(InternalTime)
0
 

Author Comment

by:sporfex
ID: 6843853
Sorry, error is this line (the other was messed up for some reason):  InternalTime = cdec(InternalTime)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:loveneesh_bansal
ID: 6843877
hi

Cdec is only supported in visual basic not in asp.

Bye

loveneesh
0
 

Author Comment

by:sporfex
ID: 6843883
loveneesh,

What shall I use instead?
0
 
LVL 11

Accepted Solution

by:
thunderchicken earned 10 total points
ID: 6844000
My appologies via the last thread

CDbl Function
See Also
CBool Function | CByte Function | CCur Function | CDate Function | CInt Function | CLng Function | CSng Function | CStr Function
Requirements
Version 1
Returns an expression that has been converted to a Variant of subtype Double.

CDbl(expression)
The expression argument is any valid expression.

Remarks
In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CDbl or CSng to force double-precision or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

Use the CDbl function to provide internationally aware conversions from any other data type to a Double subtype. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.

This example uses the CDbl function to convert an expression to a Double.

Dim MyCurr, MyDouble
MyCurr = CCur(234.456784)              ' MyCurr is a Currency (234.4567).
MyDouble = CDbl(MyCurr * 8.2 * 0.01)   ' Convert result to a Double (19.2254576).
Requirements
Version 1

These also will work in VBScript:

CBool Function | CByte Function | CCur Function | CDate Function | CInt Function | CLng Function | CSng Function | CStr Function
0
 

Author Comment

by:sporfex
ID: 6844057
This was much. How should I implement that? I'm lost. You know I'm not an educated programmer. I just puzzle things together and get it to work. Sometimes..
0
 
LVL 2

Expert Comment

by:damienm
ID: 6844197
i.e.  Use cdbl instead of cdec
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question