Problem with numbers

1. Member
Join Date
Dec 1969
Posts
69

## Problem with numbers

Hello!<BR><BR>I am facing a problem retrieving and displaying values. The datatype for the fields inSQL server table is float. <BR><BR>I am getting values from the db and am passing to parameters below is the example<BR><BR>CTR1=rs1(0)<BR>CTR2=rs1(1)<BR>ToTCT R=CTR1+CTR2<BR><BR>The problem I am facing is if CTR1=20 and CTR2=40 ToTCTR is becoming 2040 instead of 60<BR><BR>Please help this is really urgent<BR>

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Problem with numbers

CTR1 = CDbl(rs1(0))<BR>CTR2 = CDbl(rs1(1))<BR><BR>Craig.

3. Member
Join Date
Dec 1969
Posts
69

## RE: Problem with numbers

Thanks for your response. I have one more problem. When I use this function<BR><BR>Function Get_tots(FY,QT,Region,Measure,fld)<BR>sp=""<BR> sqlget="SELECT "&fld&" FROM Maintenance WHERE FinancialYear="&FY&" AND Quarter=&#039;"&QT&"&#039; and Region=&#039;"&Region&"&#039; AND MEASURE=&#039;"&Measure&"&#039;" <BR> set rsget=DataConn.execute(sqlget)<BR> <BR> if not rsget.eof then<BR> tot=0<BR> do until rsget.eof<BR> tot=cdbl(tot)+cdbl(rsget(0))<BR> rsget.movenext<BR> Loop <BR> else<BR> tot=0 <BR> end if<BR> rsget.close<BR> set rsget=Nothing<BR> <BR> &#039;if Measure="# of 911 calls and impact (&#062;1M) for Non-CDP activities" and tot&#060;&#062;0 then tot=0.04/tot<BR> if tot&#060;&#062;0 then tot=FORMATNUMBER(ROUND(tot/1000),0)<BR> if Measure="# of 911 calls and \$ impact (&#062;\$1M) for Non-CDP activities" and tot&#060;&#062;0 then tot=formatnumber(round(0.04*tot),0)<BR> <BR>Get_tots=tot <BR>end function<BR><BR>and use the values same problem exists.<BR><BR>Pls help

4. Member
Join Date
Dec 1969
Posts
69

## RE: Problem with numbers

I am sorry craig. I just checked the db the field is varchar and not float..How do I go about that

5. Senior Member
Join Date
Dec 1969
Posts
5,955