Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding numbers from mysql database 1

Status
Not open for further replies.

walkerdigest

Programmer
Feb 10, 2009
35
TR
Hi,

I am trying to add numbers from mysql database but it is not working.

in mysql database field is decimal(5,2) . when I display in asp file numbers it shows with comma not point , and it doesn't add numbers gives error. what should I do?

the code is as below:

sql2= "select * from hakemnot where hakem_id =" & hakid(k) & " and mt_baslama_yil=" & year(date)
set rs2=bag.execute(sql2)

toplamnot(k)=0

top(k)=0
toplamnot(k)=toplamnot(k)+ rs2("hakemnot") <----- gives error
 
It depends on your locale. Sounds like it is a European locale. Try changing the locale to US or UK.
 
Control Panel/Regional and Language Options. Change the format to either English(United Kingdom) or English(United States)



 
we have changed the decimal place separator to period in regional and language option in server and reboot it but nothing changed.

asp still uses comma instead of period for decimal separator.

what should I do?
 
Use

Code:
session.lcid = 2057
for UK formatting.

LCID list


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thank you.
session.lcid = 2057
worked. it gives decimals with period but still I can't add the numbers

sql2= "select * from hakemnot where hakem_id =" & hakid(k) & " and mt_baslama_yil=" & year(date)
set rs2=bag.execute(sql2)

toplamnot(k)=0

toplamnot(k)= toplamnot(k) + rs2("hakemnot")<-- gives type mismatch error

(k is defined before in a for loop)
 
Could it be possible that there are no records?

Another alternative could be that rs2("hakemnot") returns a string. Try
Code:
 toplamnot(k)= toplamnot(k) + cdbl(rs2("hakemnot"))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top