|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi my friends,
I had a database and I had two tables. in each table there is a column name "kilo" and type of the fields is number double decimal is 3. when I make a add function the result is true but when I make substract the result is so crazy and wrong. how I can solve this problem? can any body help me on this. the code is athe below. Code:
<%
strSQLTOTAL=""
strSQLTOTAL="select Sum(kilo) as sum_amount_remain from tbl_depo_giris_fisi where teslim_fisi_no="&RS_TESLIM_FISI_NO&""
set rsTOTAL=oConnection.execute(strSQLTOTAL)
If IsNull(rsTOTAL("sum_amount_remain")) = False Then
a=CDbl(rsTOTAL("sum_amount_remain"))
else
a=CDbl(0)
End If
%>
<%
strSQLTOTALBOYANMIS=""
strSQLTOTALBOYANMIS="select Sum(kilo) as sum_amount_kullanilan from tbl_renk_boyama_fisi_detay where teslim_fisi_no="&RS_TESLIM_FISI_NO&""
set rsTOTALBOYANMIS=oConnection.execute(strSQLTOTALBOY ANMIS)
If IsNull(rsTOTALBOYANMIS("sum_amount_kullanilan")) = False Then
b=CDbl(rsTOTALBOYANMIS("sum_amount_kullanilan"))
else
b=CDbl(0)
end if
%>
<%
result_total=formatnumber(CDbl(a)-CDbl(b),3)
if result_total=0 or result_total<0 then
response.Write "<font color=""#FF0000"">" & result_total & "</font>"
else
response.Write result_total
end if
%>
![]() Last edited by nahhas82 : November 6th, 2009 at 07:29 PM. |
|
#2
|
||||
|
||||
|
Can you post the values of a, b and result_total........ when you are subtracting and getting crazy results.
|
|
#3
|
|||
|
|||
|
Try this and see if it works
Code:
<%
strSQLTOTAL=""
strSQLTOTAL="select ISNULL(Sum(kilo),0) as sum_amount_remain from tbl_depo_giris_fisi where teslim_fisi_no="&RS_TESLIM_FISI_NO&""
set rsTOTAL=oConnection.execute(strSQLTOTAL)
a=rsTOTAL("sum_amount_remain")
%>
<%
strSQLTOTALBOYANMIS=""
strSQLTOTALBOYANMIS="select ISNULL(Sum(kilo),0) as sum_amount_kullanilan from tbl_renk_boyama_fisi_detay where teslim_fisi_no="&RS_TESLIM_FISI_NO&""
set rsTOTALBOYANMIS=oConnection.execute(strSQLTOTALBOY ANMIS)
b=rsTOTALBOYANMIS("sum_amount_kullanilan")
%>
<%
result_total=a-b
if result_total<=0 then
response.Write "<font color=""#FF0000"">" & formatnumber(result_total,3) & "</font>"
else
response.Write formatnumber(result_total,3)
end if
%>
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Add and substract problem... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|