Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,382 members, 7,800,770 topics. Date: Thursday, 18 April 2024 at 06:20 AM

Vb 6 - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Vb 6 (1183 Views)

My Board Games In Vb 6.0 / Vb 6.0/vb .NET & Intranet/internet Application Development / Post Ur Vb 6.0 Questions Here (2) (3) (4)

(1) (Reply) (Go Down)

Vb 6 by bigafees: 6:48pm On Jul 20, 2009
pls can any body help me with code on how to add subtotal of numbers in the database in VB6 using MS Access
Re: Vb 6 by BigStar1(m): 3:06pm On Jul 21, 2009
Chairman, i can see the help you rendered on searching the data base. That means you are averagely done

DIM TOTALSCORE as INTEGER
REM Assuming the column SCORE had been declare to take interger
TOTALSCORE = 0
WHILE rs.moveNext()
TOTALSCORE = TOTALSUM + !SCORE
WEND
It been long i coded in vb6.0. The code might not be error free. because i always face the problem of using on programming language style in another untill when the compiler rejects it. Thanks
Re: Vb 6 by luckyCO(m): 11:58am On Jul 22, 2009
dim db as new adob.connection
dim rs as new adob.recordset
dim subTotalValue as long

db.connection="your conection string"
db.open
set rs=db.execute("Select sum(subtotal) from <your table>"wink
subTotalValue=rs.fields(0).value
rs.close
db.close

Hope this solves your problem
If it didnt hit https://www.nairaland.com/nigeria/topic-60292.0.html and explain your questions there, if need be I will write a sample and sent it to you.

Take care and bye for now.
Re: Vb 6 by dotzok: 10:20am On Jul 23, 2009
The second solution above is super. I assumed you have connected to ur Db already and already making use of a Recordset,

DIm Sum as double, i as inteher
' This is what the first responder meant
for i = 1 to rs_mee.Recordset.Recordcount
sum = sum + rs_mee.RecordSet.Fields("number") 'ur column to sum
rs_mee.Recordset.Movenext
next i
F5
Re: Vb 6 by luckyCO(m): 10:14am On Jul 24, 2009
The second solution above is super. I assumed you have connected to ur Db already and already making use of a Recordset,

DIm Sum as double, i as inteher
' This is what the first responder meant
for i = 1 to rs_mee.Recordset.Recordcount
sum = sum + rs_mee.RecordSet.Fields("number"wink 'ur column to sum
rs_mee.Recordset.Movenext
next i
F5

why do you think looping is better in database where SQL can solve the same problem.
Consider having 10m records and you loop to get the subtotal, what will happen if you need to do many time by may people on the network?

db.connection="your conection string"
db.open
set rs=db.execute("Select sum(subtotal) from <your table>"wink
subTotalValue=rs.fields(0).value
rs.close
db.close

with the above code the system will assume as if you are opening and fetching the database at the same time sums your subtotal and your result will be returned to you, even if you are querying by many people.

plz dont alway depend on loop as if you are writing QBASIC where SQL can handle the same job!
Re: Vb 6 by tolubonnke: 11:19am On Jul 29, 2009
can someone help me with linking vb6.0 and mssql server 2000 and mysql too. i've been having lots of problem creating a database tht works fine with vb on both.

(1) (Reply)

Deleted / Free Research Project/thesis Sourcecode In Computer Science / C# Programmers, Is It Worth It To Have A Microsoft Certification?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 34
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.