-
Ledger
I am developing a datebase Program in VB6.0 for which I have placed a Text Box on a certain form.This text box is to contain the sum of all the values in a certain column of DBGrid control.
I simply cannot comeup with a code to tell the program to go through the column.
Urgent help is neede as my project is stuck
Thankx in advace...
-
Re: Ledger
yesterday, Chris Eastwood posted code for iterating over all rows of a dbgrid using the TextArray property of the grid control.
Use that to calculate the sum of a certain column.
-
Re: Ledger
Or use a SUM SQL query if possible (which is probably faster then looping through the control to get the values)
Crazy D @ Work :-)
-
Re: Ledger
I have tried using the SUM in SQL:
Select [Sum(ColumnName)] as [DummyName] from [DatabaseTable]
It works fine in Data Manager but when I use the following code
Dim Sql as string
Sql= Above Statement
Adodc1.recordsource=sql
adodc1.refresh
the following error occurs
"At least one Parameter is missing"
I would appreciate if any help is extended
Thankx in advance
-
Re: Ledger
It works Fine. Check parentheses.
-
Re: Ledger
Thanks for the hint.I have already checked paranthses but it still does not work.
What do u say about the fact that when the Recordsource Property of ADODc is set to cmd Table ,the ADODC control does not accept any SQL Commands ,even through VB Code.If I set it to cmdTExt then it does not allow me to move further unless I put an SQL Query in the text box.
Which query works: the one in the Property Page or the one in the Code
Thankx in advance...