Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > type mismatch when caculating

Reply
Thread Tools

type mismatch when caculating

 
 
eddie wang
Guest
Posts: n/a
 
      04-16-2004
The following caculcation will result type mismatch:
boe_net=oil_net+oil_gross .

Here is the value:
oil_net: 69997
oil_grss: 84651


Here is the code:
strSQl = "SELECT nvl(ROUND(SUM(A.NET_STD_PB_VOL)),0) OIL_NET,
ROUND(SUM(A.GROSS_STD_PB_VOL)) OIL_GROSS,
NVL(ROUND((SUM(A.NET_STD_PB_VOL) / SUM(A.GROSS_STD_PB_VOL)) * 100, 2),0)
EST_AGGR_OIL_INTEREST "&_
"FROM OGDWMART.PO_CMPL_MTH_ALLOC_VOL_F A"

Set rs = conn(strSQl)
if not rs.EOF then
oil_int = rs("EST_AGGR_OIL_INTEREST")
oil_net = rs("OIL_NET")
oil_gross = rs("OIL_GROSS")
boe_net=oil_net+oil_gross
end if

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Scott McNair
Guest
Posts: n/a
 
      04-16-2004
eddie wang <(E-Mail Removed)> wrote in news:#hjbL$8IEHA.3968
@TK2MSFTNGP12.phx.gbl:

> Set rs = conn(strSQl)
> if not rs.EOF then
> oil_int = rs("EST_AGGR_OIL_INTEREST")
> oil_net = rs("OIL_NET")
> oil_gross = rs("OIL_GROSS")
> boe_net=oil_net+oil_gross
> end if


Just to be safe, make it:

boe_net=CInt(oil_net)+CInt(oil_gross)
 
Reply With Quote
 
 
 
 
Al
Guest
Posts: n/a
 
      04-17-2004
How about this

ReturnValue = clng(A_Value) + clng(B_Value)

if A_Value Or B_Value exceed the 64bit of a long Type
then use the cdbl(A_Value) + cdbl(B_Value)

Good luck..!


"eddie wang" <(E-Mail Removed)> wrote in message
news:%23hjbL$(E-Mail Removed)...
> The following caculcation will result type mismatch:
> boe_net=oil_net+oil_gross .
>
> Here is the value:
> oil_net: 69997
> oil_grss: 84651
>
>
> Here is the code:
> strSQl = "SELECT nvl(ROUND(SUM(A.NET_STD_PB_VOL)),0) OIL_NET,
> ROUND(SUM(A.GROSS_STD_PB_VOL)) OIL_GROSS,
> NVL(ROUND((SUM(A.NET_STD_PB_VOL) / SUM(A.GROSS_STD_PB_VOL)) * 100, 2),0)
> EST_AGGR_OIL_INTEREST "&_
> "FROM OGDWMART.PO_CMPL_MTH_ALLOC_VOL_F A"
>
> Set rs = conn(strSQl)
> if not rs.EOF then
> oil_int = rs("EST_AGGR_OIL_INTEREST")
> oil_net = rs("OIL_NET")
> oil_gross = rs("OIL_GROSS")
> boe_net=oil_net+oil_gross
> end if
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Type Mismatch error indexed name returns a value whose type does not match programmingzeal VHDL 0 05-06-2012 06:38 AM
type mismatch error amitbadgi@gmail.com ASP .Net 3 08-12-2005 11:23 AM
data type mismatch error amitbadgi@gmail.com ASP .Net 1 08-10-2005 01:04 PM
Type mismatch using Mozilla ActiveX in place of Microsoft WebBrowser? Noozer Firefox 0 05-19-2004 08:08 AM
type mismatch when caculating eddie wang ASP General 1 04-19-2004 01:47 PM



Advertisments